Skip to content

[DependencyInjection] Notice: Only variable references should be returned by reference #39089

@greg0ire

Description

@greg0ire

Symfony version(s) affected: 5.1.8

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy