Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#828161
Dear All,

I am trying to migrate a few of my working processes from PM 3.3.6 to PM 3.4.11; they use PhpSpreadsheet library and are working fine on 3.3.6.
However on 3.4.11 while trying to save the file using $writer->save() as shown in below sample code; it gives the following error. I have ensured the path has write permission, for further information OS is Centos 7 and server is Nginx.
Code: Select all
$filename = "Test" . date('YmdHis') . ".xlsx"; 
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->setOffice2003Compatibility(true);
$writer->save($filename); 
Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120 Stack trace: #0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL) #1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array) #2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure)) #3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(6 in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120 Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120 Stack trace: #0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL) #1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array) #2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure)) #3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(6 in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120
While checking the error online, the common indication was to ensure, that there are no url() or asset() or other helpers functions inside your configuration files.
Crosschecked in config/*.php files and could not find any thing with such problem, more to that running route list did not return any routes as well
php artisan route:list
Your application doesn't have any routes.
Any suggestion will be very helpful on how to move forward.
Thank in advance for your help.

Best regards
Satya
#828327
Dear All,

I too have been having problems with the PhpSpreadsheet implementation in PM 3.4.11.
Code works well directly in a PHP script file, but not in a trigger within PM.

Below is my test code. File gets created and saved. creatReader works well.
So all works well till I get to the load function.

PM 3.4.11 PHP: 7.3.21 PhpSpreadsheet latest version "1.14"

Much appreciated if someone could give me a hand on this.

Thank you
Aj


require_once 'vendor/autoload.php';
$spreadsheet = new PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');
$writer = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save('hello_world.xlsx');
print "<pre>"; var_dump($writer);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx"); // GOOD
$reader->setReadDataOnly(true); // GOOD
print "<pre>"; var_dump($reader);
$reader->load("hello_world.xlsx"); //Uncaught TypeError
//$reader = \PhpOffice\PhpSpreadsheet\IOFactory::load("hello_world.xlsx"); //Uncaught TypeError

print "<pre>"; var_dump($reader); die();



###### OUTPUT ##################
.
.
.

["stringTable":"PhpOffice\PhpSpreadsheet\Writer\Xlsx":private]=>
array(1) {
[0]=>
string(13) "Hello World !"
}
["stylesConditionalHashTable":"PhpOffice\PhpSpreadsheet\Writer\Xlsx":private]=>
object(PhpOffice\PhpSpreadsheet\HashTable)#554 (2) {
["items":protected]=>
array(0) {
}
["keyMap":protected]=>
array(0) {
}
}
.
.
.object(PhpOffice\PhpSpreadsheet\Reader\Xlsx)#567 (8) {
["referenceHelper":"PhpOffice\PhpSpreadsheet\Reader\Xlsx":private]=>
object(PhpOffice\PhpSpreadsheet\ReferenceHelper)#573 (0) {
}
["readDataOnly":protected]=>
bool(true)
["readEmptyCells":protected]=>
bool(true)
["includeCharts":protected]=>
bool(false)
["loadSheetsOnly":protected]=>
NULL
["readFilter":protected]=>
object(PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter)#568 (0) {
}
["fileHandle":protected]=>
NULL
["securityScanner":protected]=>
object(PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner)#574 (2) {
["pattern":"PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner":private]=>
string(9) "
NULL
}
}

Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120
Stack trace:
#0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL)
#1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure))
#3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(6 in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120

Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120
Stack trace:
#0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL)
#1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure))
#3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(6 in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120
#828332
Hi satyaprakashsp,

Thank you for setting me in the right path.

So my prob was also the Fatal error: Class 'ZipArchive'.

I had check for zip php-zip php-pecl-zip and they were all installed.

So added to my script a var_dump(extension_loaded('zip'));
and that returned a bool(false)

So all I had to do was a restart of php-fpm and nginx and that was it !!!!???

Sometimes the simplest of things are left unthought-of.

Aj

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]

BC. Game Clone Script is a ready-made software sol[…]

A cryptocurrency exchange script is essentially pr[…]