Re: TypeError in ExternalReferrer under php8
"Marc-Etienne Vargenau (Nokia)" <[email protected]> Wed, 8 Nov 2023 18:54:44 +0000
| Newsgroups | gmane.comp.web.wiki.phpwiki.talk |
|---|---|
| Message-ID | <PR3PR07MB8183A4FF4771BE31CBE22459ACA8A@PR3PR07MB8183.eurprd07.prod.outlook.com> |
--===============8660064785054218512== Content-Language: fr-FR Content-Type: multipart/alternative; boundary="_000_PR3PR07MB8183A4FF4771BE31CBE22459ACA8APR3PR07MB8183eurp_" --_000_PR3PR07MB8183A4FF4771BE31CBE22459ACA8APR3PR07MB8183eurp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 [email protected]<mailto:marc-etienne.v= [email protected]> 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 <[email protected]> Date : mardi, 24 octobre 2023 =E0 21:35 =C0 : [email protected] <[email protected]= t> Cc : Thom Jeera <[email protected]> Objet : [Phpwiki-talk] TypeError in ExternalReferrer under php8 CAUTION: This is an external email. Please be very careful when clicking li= nks or opening attachments. See the URL nok.it/ext for additional informati= on. 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 r= eferrer code, which breaks under php8 (seems ok in php5 - I couldn't recrea= te 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 q= uery string (ie the tested value IS empty), then $url is still an array whe= n it gets passed into stristr, hence the error. if (!empty($url["query"])) { $url =3D $url["query"]; } if ($query1 and @stristr($url, $query1)) { The behaviour is present but the error gets suppressed under earlier versio= ns 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/web= chris/html/phpwiki-1.6.1/lib/ExternalReferrer.php:129 Stack trace: #0 /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.php(129): stri= str() #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): isExternalRef= errer() #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->act= ion_browse() #5 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1451): WikiRequest->ha= ndleAction() #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 o= n line 129', referer: android-app://com.google.android.gm/ Regards, Thom. _______________________________________________ Phpwiki-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/phpwiki-talk --_000_PR3PR07MB8183A4FF4771BE31CBE22459ACA8APR3PR07MB8183eurp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc= hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of= fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-= 1"> <meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:10.0pt; font-family:"Calibri",sans-serif;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} span.EmailStyle19 {mso-style-type:personal-reply; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-size:10.0pt; mso-ligatures:none;} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 70.85pt 70.85pt;} div.WordSection1 {page:WordSection1;} --></style> </head> <body lang=3D"FR" link=3D"blue" vlink=3D"purple" style=3D"word-wrap:break-w= ord"> <div class=3D"WordSection1"> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language= :EN-US">Hi Thom,<o:p></o:p></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language= :EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US">Thank you for the report.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US">I will test and provide a fix.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US">Is your Phpwiki internal or available on the Interne= t?<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US">Best regards,<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US">Marc-Etienne<o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <div> <div> <p class=3D"MsoNormal"><span style=3D"font-family:"Courier New";c= olor:#212121">-- <br> Marc-Etienne Vargenau <a href=3D"mailto:marc-etienne.vargenau@nok= ia.com" title=3D"mailto:[email protected]"><span style=3D"col= or:#0078D7;text-decoration:none">marc-etienne</span><span style=3D"color:#0= 078D7">[email protected]</span></a><br> Nokia, 12, rue Jean-Bart, 91300 Massy, FRANCE<br> Mobile: <a href=3D"tel:+33624497868"><span style=3D"color:#0078D7">+33= 6 24 49 78 68</span></a></span><span style=3D"font-size:11.0pt;color:#2121= 21"><o:p></o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-family:"Cour= ier New";color:#212121">Senior Specialist Open Source<br> Planned absence: </span><b><span lang=3D"EN-US" style=3D"font-size:11.= 0pt;font-family:"Courier New";color:#212121">none</span></b><span= lang=3D"EN-US" style=3D"font-size:11.0pt;color:#212121"><o:p></o:p></span>= </p> </div> </div> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;mso-f= areast-language:EN-US"><o:p> </o:p></span></p> <div id=3D"mail-editor-reference-message-container"> <div> <div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm = 0cm 0cm"> <p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><b><span style=3D"fon= t-size:12.0pt;color:black">De : </span></b><span style=3D"font-size:12.0pt;color:black">Thom Jeera via Phpw= iki-talk <[email protected]><br> <b>Date : </b>mardi, 24 octobre 2023 =E0 21:35<br> <b>=C0 : </b>[email protected] <phpwiki-talk@lists= .sourceforge.net><br> <b>Cc : </b>Thom Jeera <[email protected]><br> <b>Objet : </b>[Phpwiki-talk] TypeError in ExternalReferrer under php8= <o:p></o:p></span></p> </div> <div> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><br> CAUTION: This is an external email. Please be very careful when clicking li= nks or opening attachments. See the URL nok.it/ext for additional informati= on.<br> <br> <br> <br> Hi - I'm running phpwiki-1.6.2 on php 8.2.11.<br> <br> 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 r= eferrer code, which breaks under php8 (seems ok in php5 - I couldn't recrea= te it against phpwiki.demo.free.fr for instance).<br> <br> Something like this would trigger it under php8:<br> <br> curl -H 'referer: android-app://com.google.android.gm/' <a href=3D"http://p= hpwiki.demo.free.fr/index.php/SandBox"> http://phpwiki.demo.free.fr/index.php/SandBox</a><br> <br> The code here in ExternalReferrer.php looks inconsistent - if there is no q= uery string (ie the tested value IS empty), then $url is still an array whe= n it gets passed into stristr, hence the error.<br> <br> if (!empty($url["query"= ;])) {<br> $url =3D= $url["query"];<br> }<br> <br> if ($query1 and @stristr($url, $= query1)) {<br> <br> The behaviour is present but the error gets suppressed under earlier versio= ns of php.<br> <br> Suggested fix: add "else return false;" after the !empty test ?<b= r> <br> <br> Reported error:<br> <br> Got error 'PHP message: PHP Fatal error: Uncaught TypeError: stristr(= ):<br> Argument #1 ($haystack) must be of type string, array given in /syshome/web= chris/html/phpwiki-1.6.1/lib/ExternalReferrer.php:129<br> Stack trace:<br> #0 /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.php(129): stri= str()<br> #1 /syshome/webchris/html/phpwiki-1.6.1/lib/stdlib.php(1890): SearchEngines= ->parseSearchQuery()<br> #2 /syshome/webchris/html/phpwiki-1.6.1/lib/display.php(324): isExternalRef= errer()<br> #3 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1069): displayPage()<b= r> #4 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(816): WikiRequest->= action_browse()<br> #5 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1451): WikiRequest->= ;handleAction()<br> #6 /syshome/webchris/html/phpwiki-1.6.1/lib/main.php(1475): main()<br> #7 /syshome/webchris/html/phpwiki-1.6.1/index.php(60): include('...')<br> #8 {main}<br> thrown in /syshome/webchris/html/phpwiki-1.6.1/lib/ExternalReferrer.= php on line 129', referer: android-app://com.google.android.gm/<br> <br> <br> Regards,<br> Thom.<br> <br> <br> _______________________________________________<br> Phpwiki-talk mailing list<br> [email protected]<br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/phpwiki-talk">https= ://lists.sourceforge.net/lists/listinfo/phpwiki-talk</a><o:p></o:p></span><= /p> </div> </div> </div> </div> </body> </html> --_000_PR3PR07MB8183A4FF4771BE31CBE22459ACA8APR3PR07MB8183eurp_-- --===============8660064785054218512== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============8660064785054218512== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Phpwiki-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/phpwiki-talk --===============8660064785054218512==--