note 108816 added to function.parse-url

From: Date: Sat, 26 May 2012 20:10:47 +0000
Subject: note 108816 added to function.parse-url
Groups: php.notes 
Request: Send a blank email to php-notes+get-188254@lists.php.net to get a copy of this message
All of those who are writing parse_query functions to parse URL queries should note two things (as seen above, everyone trying, got these missing). 1. Fields can be separated by semicolons also, not just the &, thus: field1=val1;field2=val2 is a valid query, with two fields. So instead exploding on & you should split like: <?php $queryFields = split('[;&]', $data['query']); ?> 2. Fields don't necessarily get values. As seen on many places, there are URLs like page.php?fail So you should test if you get a second return value after exploding on equal sign ---- Server IP: 69.147.83.197 Probable Submitter: 79.116.72.184 ---- Manual Page -- http://www.php.net/manual/en/function.parse-url.php Edit -- https://master.php.net/note/edit/108816 Del: integrated -- https://master.php.net/note/delete/108816/integrated Del: useless -- https://master.php.net/note/delete/108816/useless Del: bad code -- https://master.php.net/note/delete/108816/bad+code Del: spam -- https://master.php.net/note/delete/108816/spam Del: non-english -- https://master.php.net/note/delete/108816/non-english Del: in docs -- https://master.php.net/note/delete/108816/in+docs Del: other reasons-- https://master.php.net/note/delete/108816 Reject -- https://master.php.net/note/reject/108816 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188254) next »