doctrine / lexer

Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
https://www.doctrine-project.org/projects/lexer.html
MIT License
11.07k stars 60 forks source link

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

Closed jmmorillon closed 4 years ago

jmmorillon commented 5 years ago

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 commented 5 years ago

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

jmmorillon commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

alcaeus commented 5 years ago

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 commented 5 years ago

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

albertoeps commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Here's someone else facing the same problem:

https://github.com/creof/doctrine2-spatial/issues/203 https://github.com/creof/doctrine2-spatial/issues/204

alcaeus commented 5 years ago

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

xabbuh commented 5 years ago

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

PowerKiKi commented 4 years ago

This should be closed because fixed via https://github.com/creof/geo-parser/pull/18

greg0ire commented 4 years ago

Amen

max4ever commented 2 years ago

Fixed by ugprading doctrine/orm from 2.6 to 2.7