-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hello,
I have encountered a strange bug regarding the configuration of the port in the neo4j.yml file on an application in Symfony 4.3.
If the port is 'hard' configured - aka 7687 -, all is ok. But if we refer instead to an environment variable with the syntax '%env(NEO4J_PORT)%', everything crumbles and the connection crashes with this following error message:
In StreamSocket.php line 203:
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known
The crazy thing is that the port is the only configuration leading to that bug, using environment variables to configure the host or the user is ok.
Digging into the bundle, I finally found the origin of the problem: the port is cast into an integer in the depency injection: https://github.com/neo4j-contrib/neo4j-symfony/blob/master/DependencyInjection/Neo4jExtension.php#L206
That cast is ok if the port is 'hard' configured, but if someone want to use an environment variable it's no longer working because Symfony does not inject at this step the values of the variable but a proxy which will be solved later, in my example env_e68e500d790ef07c_NEO4J_PORT_2f05a784d88d91a07d4331d3f53a7cab
. Casting this string into an integer returns 0, causing a lot of troubles in cascade.
Is it possible to correct this point? The solution is to use the pattern '% s: //% s:% s @% s:% s'
instead of '% s: //% s:% s @% s:% d'
Thank you !