From: guth at fiifo dot u-psud dot fr
Operating system: Linux (Mandrake 10)
PHP version: 5.0.1
PHP Bug Type: URL related
Bug description: problem in pathinfo() et parse_url()
Description:
------------
pathinfo() and parse_url() doesn't handle null characters
Reproduce code:
---------------
/* test 1*/
var_dump(pathinfo("file.p\x00hp"));
/* test 2 */
var_dump(pathinfo("fi\x00le.php"));
/* test 3 */
var_dump(parse_url("./file.php"));
/* test 4 */
var_dump(parse_url("./fi\x00le.php"));
Expected result:
----------------
(\0 means null character)
/* test 1 */
array(3) {
["dirname"]=>
string(1) "."
["basename"]=>
string(9) "file.p\0hp"
["extension"]=>
string(4) "p\0hp"
}
/* test 2 */
array(3) {
["dirname"]=>
string(1) "."
["basename"]=>
string(9) "fi\0le.php"
["extension"]=>
string(4) "php"
}
/* test 3 */
array(1) {
["path"]=>
string(10) "./file.php"
}
/* test 4 */
array(1) {
["path"]=>
string(10) "./fi\0le.php"
}
Actual result:
--------------
/* test 1 */
=> OK
/* test 2 */
array(3) {
["dirname"]=>
string(1) "."
["basename"]=>
string(9) "fi\0le.php"
}
Extension should be "php".
/* test 3 */
=> OK
/* test 4 */
array(1) {
["path"]=>
string(10) "./fi"
}
--
Edit bug report at http://bugs.php.net/?id=29913&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29913&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29913&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29913&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29913&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29913&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29913&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29913&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29913&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29913&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29913&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29913&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29913&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29913&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29913&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29913&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29913&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29913&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29913&r=float