Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php.CRITICAL: preg_split() expects parameter 2 to be string, float given #31

Closed
jmmorillon opened this issue Aug 1, 2019 · 16 comments
Closed

Comments

@jmmorillon
Copy link

Hello,

I've a critical error with version 1.1.0
It seems to bug at init app.

[2019-08-01 11:20:41] php.CRITICAL: preg_split() expects parameter 2 to be string, float given {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): preg_split() expects parameter 2 to be string, float given at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php:255)"} []
[2019-08-01 11:20:41] request.CRITICAL: Uncaught PHP Exception TypeError: "preg_split() expects parameter 2 to be string, float given" at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php line 255 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): preg_split() expects parameter 2 to be string, float given at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php:255)"} []

@alcaeus
Copy link
Member

alcaeus commented Aug 1, 2019

Can you please post the full trace for this error? Thanks!

@jmmorillon
Copy link
Author

jmmorillon commented Aug 2, 2019

Yes of course

[2019-08-01 11:20:41] request.INFO: Matched route "api_get_app_init". {"route":"api_get_app_init","route_parameters":{"_route":"api_get_app_init","_api_respond":true,"_api_normalization_context":{"api_sub_level":true},"_api_swagger_context":{"tags":["AppInit"],"summary":"Retrieve list of app init parameters","parameters":[{"name":"appID","in":"query","required":"true","type":"string","description":"Mobile App ID"},{"name":"deviceWidth","in":"query","required":"true","type":"integer","description":"Witdh of the device"},{"name":"lang","in":"query","required":"true","type":"string","description":"Language"}],"responses":{"201":{"description":"List of App Init parameters","schema":{"type":"object","properties":[]}}}},"_controller":"App\\Controller\\Api\\AppInitController"},"request_uri":"https://xxxxxxxxxxx/api/app_init?appID=0810.dublin.clt001&lang=en&width=360","method":"GET"} []
[2019-08-01 11:20:41] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2019-08-01 11:20:41] php.CRITICAL: preg_split() expects parameter 2 to be string, float given {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): preg_split() expects parameter 2 to be string, float given at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php:255)"} []
[2019-08-01 11:20:41] request.CRITICAL: Uncaught PHP Exception TypeError: "preg_split() expects parameter 2 to be string, float given" at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php line 255 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): preg_split() expects parameter 2 to be string, float given at /var/www/clients/client1/web8/web/sfserv2018/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php:255)"} []

(edited for code blocks)

@alcaeus
Copy link
Member

alcaeus commented Aug 2, 2019

Unfortunately, that log you provided does not include a full stack trace of the error. I'm looking for a trace that shows where the method was called with a float. An implicit typecast is out of the question, which is why I want to know which source package is calling this with the wrong argument type. Thanks!

@malarzm
Copy link
Member

malarzm commented Aug 2, 2019

Hmmm could this happen with something like @Annotation(float=2.1)?

@alcaeus
Copy link
Member

alcaeus commented Aug 2, 2019

I'm not sure, I'd have to set up a test. In that case, I'd argue for fixing it where it's broken ;)

@jmmorillon
Copy link
Author

Hi thanks to @malarzm and you @alcaeus , I've found where to search and what. Error seems to trigger with a type "point" added by creof/doctrine2-spatial. When I remove ORM\Column annotation with this type, all work well.
Now, I just have to find a workaround ... :)
Thanks a lot

@albertooishii
Copy link

Hi @jmmorillon, I've the same problem, but I haven't been able to find a solution.

Did you find a way to fix it? Thank you very much.

@jmmorillon
Copy link
Author

@albertoeps For the moment I’ve forced the use of version 1.0.2 and my app works well.
I am on holidays for 2 weeks, so I’ll try to find a better solution later.

@alcaeus
Copy link
Member

alcaeus commented Aug 4, 2019

Again, if someone can please give me a trace I'll happily look into it. However, I haven't managed to reproduce it at all so far.

@mareksuscak
Copy link

mareksuscak commented Aug 5, 2019

Same issue here — we're using creof/doctrine2-spatial and after upgrading doctrine/lexer we're getting this error but the stack trace is somewhat cryptic. Here it is though:

Symfony\Component\Debug\Exception\FatalThrowableError: preg_split() expects parameter 2 to be string, float given
#29 /vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php(255): preg_split
#28 /vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php(255): Doctrine\Common\Lexer\AbstractLexer::scan
#27 /vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php(93): Doctrine\Common\Lexer\AbstractLexer::setInput
#26 /vendor/creof/geo-parser/lib/CrEOF/Geo/String/Parser.php(91): CrEOF\Geo\String\Parser::parse
#25 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php(70): CrEOF\Spatial\PHP\Types\AbstractPoint::setX
#24 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php(220): CrEOF\Spatial\PHP\Types\AbstractPoint::construct
#23 [internal](0): call_user_func_array
#22 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php(56): CrEOF\Spatial\PHP\Types\AbstractPoint::__construct
#21 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php(120): CrEOF\Spatial\DBAL\Platform\AbstractPlatform::newObjectFromValue
#20 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php(64): CrEOF\Spatial\DBAL\Platform\AbstractPlatform::convertBinaryToPHPValue
#19 /vendor/creof/doctrine2-spatial/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php(142): CrEOF\Spatial\DBAL\Types\AbstractSpatialType::convertToPHPValue
#18 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(315): Doctrine\ORM\Internal\Hydration\AbstractHydrator::gatherRowData
#17 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php(331): Doctrine\ORM\Internal\Hydration\ObjectHydrator::hydrateRowData
#16 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php(162): Doctrine\ORM\Internal\Hydration\ObjectHydrator::hydrateAllData
#15 /vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(152): Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateAll
#14 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(976): Doctrine\ORM\AbstractQuery::executeIgnoreQueryCache
#13 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(922): Doctrine\ORM\AbstractQuery::execute
#12 /vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(726): Doctrine\ORM\AbstractQuery::getResult
#11 /src/Spalneo/GeneralBundle/Repository/PolygonRepository.php(45): Spalneo\GeneralBundle\Repository\PolygonRepository::getLocalizedCitiesByName
#10 /src/Spalneo/Api/WebBundle/Controller/V1/VenueController.php(76): Spalneo\Api\WebBundle\Controller\V1\VenueController::getLocationsAction
#9 /vendor/symfony/http-kernel/HttpKernel.php(151): Symfony\Component\HttpKernel\HttpKernel::handleRaw
#8 /vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel::handle
#7 /vendor/symfony/http-kernel/Kernel.php(198): Symfony\Component\HttpKernel\Kernel::handle
#6 /vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle
#5 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(478): Symfony\Component\HttpKernel\HttpCache\HttpCache::forward
#4 /vendor/symfony/framework-bundle/HttpCache/HttpCache.php(57): Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache::forward
#3 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(450): Symfony\Component\HttpKernel\HttpCache\HttpCache::fetch
#2 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(347): Symfony\Component\HttpKernel\HttpCache\HttpCache::lookup
#1 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(222): Symfony\Component\HttpKernel\HttpCache\HttpCache::handle
#0 /public/index.php(32): null

Here's what we're passing in to call_user_func_array:

image

@mareksuscak
Copy link

mareksuscak commented Aug 5, 2019

Here's someone else facing the same problem:

creof/doctrine2-spatial#203
creof/doctrine2-spatial#204

@alcaeus
Copy link
Member

alcaeus commented Aug 5, 2019

Thank you @mareksuscak! I'll try to reproduce this later today!

@xabbuh
Copy link
Member

xabbuh commented Aug 5, 2019

Does creof/doctrine2-spatial#205 fix the issue for you?

@PowerKiKi
Copy link

This should be closed because fixed via creof/geo-parser#18

@greg0ire
Copy link
Member

greg0ire commented Jan 3, 2020

Amen

@greg0ire greg0ire closed this as completed Jan 3, 2020
@max4ever
Copy link

Fixed by ugprading doctrine/orm from 2.6 to 2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants