Description
I'm getting the notice in the title. The code that causes it looks like this:
$accessor = function & () use ($targetObject, $name, $value) {
return $targetObject->$name = $value;
};
How to reproduce
I don't know how to reproduce the generation of this piece of code yet, but reproducing the notice is easy enough:
https://3v4l.org/dE26T
I suspect it is related to this service definition (which looks quite simple):
#Config amqp_lib
PhpAmqpLib\Connection\AMQPStreamConnection:
lazy: true
class: PhpAmqpLib\Connection\AMQPStreamConnection
arguments:
- "%swarrot.host%"
- "%swarrot.port%"
- "%swarrot.login%"
- "%swarrot.password%"
- "%swarrot.vhost%"
Possible solution
Do it in 2 steps: https://3v4l.org/j501X ?
Stack trace:
/var/www/var/cache/prod/ContainerMifQx3V/AMQPStreamConnection_99651dd.php:251,
--
/var/www/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php:643,
/var/www/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php:234,
/var/www/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php:351,
/var/www/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php:287,
/var/www/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php:117,
/var/www/var/cache/prod/ContainerMifQx3V/getAMQPChannelService.php:35,
/var/www/var/cache/prod/ContainerMifQx3V/getAMQPChannelService.php:23,
/var/www/var/cache/prod/ContainerMifQx3V/AMQPChannel_f219a5d.php:116,
/var/www/var/cache/prod/ContainerMifQx3V/AMQPChannel_f219a5d.php:116,
/var/www/src/Index/Prepare/PrepareProductToIndex.php:173,
/var/www/src/Index/Prepare/PrepareProductToIndex.php:114,
/var/www/src/Index/Prepare/PrepareProductToIndex.php:70,
/var/www/src/Command/AlgoliaPrepareReindexFullCommand.php:107,
/var/www/vendor/symfony/console/Command/Command.php:258,
/var/www/vendor/symfony/console/Application.php:938,
/var/www/vendor/symfony/framework-bundle/Console/Application.php:96,
/var/www/vendor/symfony/console/Application.php:266,
/var/www/vendor/symfony/framework-bundle/Console/Application.php:82,
/var/www/vendor/symfony/console/Application.php:142,
/var/www/bin/console:49
And here is the contents of that container file: https://hastebin.net/wuzirolega.php
public function __set($name, $value)
{
$this->initializer2d678 && ($this->initializer2d678->__invoke($valueHolder0a36b, $this, '__set', array('name' => $name, 'value' => $value), $this->initializer2d678) || 1) && $this->valueHolder0a36b = $valueHolder0a36b;
if (isset(self::$publicProperties70f0e[$name])) {
return ($this->valueHolder0a36b->$name = $value);
}
$realInstanceReflection = new \ReflectionClass(get_parent_class($this));
if (! $realInstanceReflection->hasProperty($name)) {
$targetObject = $this->valueHolder0a36b;
return $targetObject->$name = $value;
return;
}
$targetObject = $this->valueHolder0a36b;
$accessor = function & () use ($targetObject, $name, $value) {
return $targetObject->$name = $value;
};
$backtrace = debug_backtrace(true, 2);
$scopeObject = isset($backtrace[1]['object']) ? $backtrace[1]['object'] : new \ProxyManager\Stub\EmptyClassStub();
$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject));
$returnValue = & $accessor();
return $returnValue;
}
I originally reported that at https://github.com/symfony/symfony/issues/39089
This comes from these lines https://github.com/Ocramius/ProxyManager/blob/f65ae0f9dcbdd9d6ad3abb721a9e09c3d7d868a4/tests/ProxyManagerTest/ProxyGenerator/Util/PublicScopeSimulatorTest.php#L78-L80
bug