From: Marc-Etienne V. (Nokia) <mar...@no...> - 2023-11-08 19:29:32
|
Hi Thom, Thank you for the report. I will test and provide a fix. Is your Phpwiki internal or available on the Internet? Best regards, Marc-Etienne -- Marc-Etienne Vargenau mar...@no...<mailto:mar...@no...> Nokia, 12, rue Jean-Bart, 91300 Massy, FRANCE Mobile: +33 6 24 49 78 68<tel:+33624497868> Senior Specialist Open Source Planned absence: none De : Thom Jeera via Phpwiki-talk <php...@li...> Date : mardi, 24 octobre 2023 à 21:35 À : php...@li... <php...@li...> Cc : Thom Jeera <tho...@pr...> Objet : [Phpwiki-talk] TypeError in ExternalReferrer under php8 CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information. Hi - I'm running phpwiki-1.6.2 on php 8.2.11. I saw an error when someone clicked a phpwiki link from within a gmail app - see bottom of email. The 'google.' in the referer triggers the external referrer code, which breaks under php8 (seems ok in php5 - I couldn't recreate it against phpwiki.demo.free.fr for instance). Something like this would trigger it under php8: curl -H 'referer: android-app://com.google.android.gm/' http://phpwiki.demo.free.fr/index.php/SandBox The code here in ExternalReferrer.php looks inconsistent - if there is no query string (ie the tested value IS empty), then $url is still an array when it gets passed into stristr, hence the error. if (!empty($url["query"])) { $url = $url["query"]; } if ($query1 and @stristr($url, $query1)) { The behaviour is present but the error gets suppressed under earlier versions of php. Suggested fix: add "else return false;" after the !empty test ? Reported error: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: stristr(): Argument #1 ($haystack) must be of type string, array given in /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.php:129 Stack trace: #0 /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.php(129): stristr() #1 /syshome/webchris/html/phpwiki-1.6.1/lib/stdlib.php(1890): SearchEngines->parseSearchQuery() #2 /syshome/webchris/html/phpwiki-1.6.1/lib/display.php(324): isExternalReferrer() #3 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1069): displayPage() #4 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(816): WikiRequest->action_browse() #5 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1451): WikiRequest->handleAction() #6 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1475): main() #7 /syshome/webchris/html/phpwiki-1.6.1/index.php(60): include('...') #8 {main} thrown in /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.php on line 129', referer: android-app://com.google.android.gm/ Regards, Thom. _______________________________________________ Phpwiki-talk mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phpwiki-talk |