Skip to content
Advertisement

Tag: php-8

session_start() giving error for session_destroy() in PHP 8

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()

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

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,

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

Advertisement