delahaye / dlh_googlemaps

Google Maps Extension für Contao
20 stars 26 forks source link

PHP 7.1: A non-numeric value encountered #71

Closed derastronaut closed 6 years ago

derastronaut commented 7 years ago

Hallo zusammen,

nach der Umstellung auf PHP 7.1 erhalte ich folgende Fehlermeldung in den Logs von Contao:

[25-Jan-2017 13:27:59 Europe/Berlin] 
PHP Warning: A non-numeric value encountered in /www/htdocs/wurst/system/modules/dlh_googlemaps/classes/Googlemap.php on line 231
#0 /www/htdocs/wurst/system/modules/dlh_googlemaps/classes/Googlemap.php(231): __error(2, 'A non-numeric v...', '/www/htdocs/wur...', 231, Array)
#1 /www/htdocs/wurst/system/modules/dlh_googlemaps/classes/Googlemap.php(131): delahaye\googlemaps\Googlemap->getElementData('1', 0, Array)
#2 /www/htdocs/wurst/system/modules/dlh_googlemaps/elements/ContentMap.php(81): delahaye\googlemaps\Googlemap::getMapData('1', 'html5', Array)
#3 /www/htdocs/wurst/system/modules/core/elements/ContentElement.php(265): delahaye\googlemaps\ContentMap->compile()
#4 /www/htdocs/wurst/system/modules/dlh_googlemaps/elements/ContentMap.php(53): Contao\ContentElement->generate()
#5 /www/htdocs/wurst/system/modules/core/library/Contao/Controller.php(484): delahaye\googlemaps\ContentMap->generate()
#6 /www/htdocs/wurst/system/modules/tags/modules/ModuleEventReaderTags.php(139): Contao\Controller::getContentElement(Object(Contao\ContentModel))
#7 /www/htdocs/wurst/system/modules/core/modules/Module.php(287): Contao\ModuleEventReaderTags->compile()
#8 /www/htdocs/wurst/system/modules/calendar/modules/ModuleEventReader.php(82): Contao\Module->generate()
#9 /www/htdocs/wurst/system/modules/core/library/Contao/Controller.php(321): Contao\ModuleEventReader->generate()
#10 /www/htdocs/wurst/system/modules/calendar/modules/ModuleEventlist.php(67): Contao\Controller::getFrontendModule('42', 'main')
#11 /www/htdocs/wurst/system/modules/core/elements/ContentModule.php(59): Contao\ModuleEventlist->generate()
#12 /www/htdocs/wurst/system/modules/core/library/Contao/Controller.php(484): Contao\ContentModule->generate()
#13 /www/htdocs/wurst/system/modules/core/modules/ModuleArticle.php(213): Contao\Controller::getContentElement(Object(Contao\ContentModel), 'main')
#14 /www/htdocs/wurst/system/modules/tags/modules/ModuleArticle.php(26): Contao\ModuleArticle->compile()
#15 /www/htdocs/wurst/system/modules/core/modules/Module.php(287): Aurealis\ModuleArticle->compile()
#16 /www/htdocs/wurst/system/modules/core/modules/ModuleArticle.php(67): Contao\Module->generate()
#17 /www/htdocs/wurst/system/modules/core/library/Contao/Controller.php(417): Contao\ModuleArticle->generate(false)
#18 /www/htdocs/wurst/system/modules/core/library/Contao/Controller.php(277): Contao\Controller::getArticle(Object(Contao\ArticleModel), false, false, 'main')
#19 /www/htdocs/wurst/system/modules/core/pages/PageRegular.php(133): Contao\Controller::getFrontendModule('0', 'main')
#20 /www/htdocs/wurst/system/modules/core/controllers/FrontendIndex.php(285): Contao\PageRegular->generate(Object(Contao\PageModel), true)
#21 /www/htdocs/wurst/index.php(20): Contao\FrontendIndex->run()
#22 {main}

Es scheint aber alles zu funktionieren. Die Maps werden im Frontend korrekt geladen und im Backend scheint auch alles ok zu sein. Habe einen Eintrag bearbeitet, alles wurde gespeichert.

Festgestellt unter Contao 3.5.24. dlh_googlemaps 2.2.0, dlh_geocode 1.0.4.

fritzmg commented 7 years ago

See also https://github.com/contao/core/issues/8617

k-webdesign commented 7 years ago

Kann ich auch bestätigen. Ist das nun ein Contao- oder Extension-Bug? 🤔

fritzmg commented 7 years ago

Extension Bug.

garyee commented 7 years ago

Would it be a solution to change this line to:

$arrElement['bounds'][2] = ((int)trim($tmp1[0]).((int)trim($tmp2[0])))/2 . ',' . ((int)trim($tmp1[1]).((int)trim($tmp2[1])))/2;

it is a solution, but I do not know if it is a good one :)

design23 commented 7 years ago

Having the same issue here, yet this

$arrElement['bounds'][2] = ((int)trim($tmp1[0]).((int)trim($tmp2[0])))/2 . ',' . ((int)trim($tmp1[1]).((int)trim($tmp2[1])))/2;

does not solve it for me.

Webstylerin commented 7 years ago

Still the same problem with PHP 7.1.4, garyees solution doesn't work for me either.

Any other solutions? :)

Webstylerin commented 7 years ago

Shame on me, garyees fix is working. I just had to edit the right file. I edited the file in system/modules but with composer the file is under composer/vendor.

garyee commented 7 years ago

I have made the same error many times ;)

fritzmg commented 7 years ago

Whether which file is the right one depends on how you installed the extension ;)

delahaye commented 6 years ago

Please reopen if this still occurs in the next release. Thanks.

zonky2 commented 6 years ago

in der 2.0.9 noch enthalten (contao 3.5.35) A non-numeric value encountered in composer/vendor/delahaye/dlh_googlemaps/classes/Googlemap.php on line 229

rentieropa commented 5 years ago

This is not a contao or extension error. It is ejected just like that in a free php-script.

rentieropa commented 5 years ago

Das ist kein contao oder Erweiterungsfehler. Er wird genau so in einem freien php-script ausgeworfen.

fritzmg commented 5 years ago

@rentieropa der Fehler tritt dann auf, wenn man, wie der Fehler schon sagt, non-numeric values mit numeric values in mathematischen Operationen mischt. So wie es auch in dieser Extension der Fall war.