You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 !
The text was updated successfully, but these errors were encountered:
Have you tried to use %env(resolve:NEO4J_PORT)%?
Also, please note that this "syntax" is deprecated in Symfony best practices, and recommend to use a dsn
configuring a dsn instead of 'individual parameters' does the job as no alteration of the value provided in the conf is done in the dependency injection.
But using %env(resolve:NEO4J_PORT)% doesn't solve the problem as it still gives a proxy instead of a value, this proxy still being cast into 0 via the sprintf.
Indeed, this port parameter used to be there to prevent BC. But it seems something needs to be done anyhow + emphasis in the doc that dsn parameter is preferred over "individual" parameters.
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 !
The text was updated successfully, but these errors were encountered: