When executing a console routine, I've encountered Can't use function return value in write context
. What intrigues me is that I've made no changes between executions. Executed once normally, executed again and there it was.
Apparently it happens on vendor\zendframework\zend-loader\src\StandardAutoloader.php
.
This is the part of the code that Xdebug is pointing to:
// Namespace and/or prefix autoloading
foreach ($this->$type as $leader => $path) {
if (0 === strpos($class, $leader)) {
// Trim off leader (namespace or prefix)
$trimmedClass = substr($class, strlen($leader));
// create filename
$filename = $this->transformClassNameToFilename($trimmedClass, $path);
if (file_exists($filename)) {
return include $filename;
$filename = "C:\xampp\htdocs\captare\module\Ecommerce/src/Ecommerce\Controller/ConsoleController.php"
I tried to include as much information as possible inside the image.
My research didn't help much.
If I put a breakpoint on the index include_once('public/index.php');
, Xdebug already shows the error and "paused on exception".
This is running on XAMPP 3.3.0 with PHP 7.4.29
I'm not fully versed into PHP and the inner workings of the Zend Framework, so please forgive me if I missed something.
I don't really know why is this happening out of nowhere and where to start looking, so just a tip of where to look would be immensely helpful! Thank you.
The error says, something like func() = 'x';
is invalid, eg. you try to assign something to a function return value.
Check your if-statements for if ( func() = $something )
, you're probably using an assignment instead of a comparsion.