All of a sudden, my custom session handlers’ session’s session_start() is not working. I had to include destroy after upgrading to PHP 8. It isn’t an issue in PHP 7.4. Fatal error: Uncaught ArgumentCountError: Too few arguments to function CBSession::destroy(), 0 passed and exactly 1 expected in Session.php: Stack trace: #0 [internal function]: CBSession::destroy() #1 /path/CB/Session.php(35): session_start() #2 /path/CB/Session.php(17): CBSession::load()
Tag: php-8
How to compile pcntl for PHP 7.4 and above?
I am attempting to compile the pcntl extension for PHP 7.4 and PHP 8 with the following commands (from Mac): wget “https://www.php.net/distributions/php-7.4.0.tar.gz” tar xvf “php-7.4.0….
Migrate to PHP 8.0: Unbinding $this when $this is used
Step by step, I am migrating my project(s) from PHP 7.1 to PHP 8.0. In the official PHP manual, in the subchapter “Deprecated Features” of the chapter “Migrating from PHP 7.3.x to PHP 7.4.x”, I tried to understand the following deprecation description: Unbinding $this when $this is used Unbinding $this of a non-static closure that uses $this is deprecated. Though,
use call_user_func in PHP 8 returns fatal error
I am trying to call a class named ContactController with the function handleContact with call_user_func([ContactController::class, ‘handleContact’]); but got following error: Fatal error: Uncaught Error: Non-static method appcontrollersContactController::handleContact() cannot be called statically Answer If the method handleContact is static than call it: If your method handleContact is not static than you need to pass an instantiated class e.g. P.S. Setting the
How to install PHP 8 on XAMPP
I’m trying to update my PHP version to the brand new PHP 8. I have followed simular steps as this tutorial. But now the following error is shown: Notice: I have used a brand new XAMPP instalation version 7.2.33. I can’t find the solution for my issue. Edit It is saying that I need to look into the Log files
php 7.4 mongodb dll file(1.9.0) not compatible with php 8 on windows 10 system
As you know PHP 8 is released I am excited and want to try it out. But I have a requirement for MongoDB, I tried adding MongoDB dll file of 7.4 to php8, it’s giving the error like. Warning: PHP …
Connection was not established Xdebug 3 with PhpStorm
Good afternoon. When an attempt is made to debug the script on PHP 8, PhpStorm reports that there is no connection with version 3 xdebug. Works with all versions below 3. I tried to change the parameters of xdebug.remote_{host, port} to xdebug.client_{host, port} but also did not help. Answer Xdebug 3 will be fully supported in PhpStorm 2020.3 version only,
Fatal error: Declaration of Foo::__toString(): void must be compatible with Stringable::__toString(): string
After upgrading to PHP 8 I’m now seeing this Fatal error what’s wrong with my code ? And what is this Stringable? Answer Prior to PHP 8 it was possible for a programmer to write magic methods that have signatures that don’t match the internal signature of them. So for example Although the return type void doesn’t match the method’s
Error generated by named arguments and argument unpacking in function call not throwing ErrorException in PHP-8
The following code works as expected: throws the ErrorException and calls the shutdown function for the fatal-error generated by require Output: require(unavailable_file): Failed to open stream: No such file or directory anyway, hello world But fatal error generated by named arguments fails to call the exception-handler and the shutdown function Output: Fatal error: Cannot combine named arguments and argument unpacking
What’s the difference between upcoming PHP8’s spread operator and it’s pre-existing compact function? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question What’s the difference between upcoming PHP8’s spread operator and it’s pre-existing compact() function ? $data = new CustomerData(…$input); Answer Differences between Compact and Spread Operator