php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30014 pathinfo() doesn't handle multibyte path
Submitted: 2004-09-07 20:26 UTC Modified: 2005-03-20 18:04 UTC
From: cvictor at pchome dot com dot tw Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 5.0.1 OS: Windows XP Pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cvictor at pchome dot com dot tw
New email:
PHP Version: OS:

 

 [2004-09-07 20:26 UTC] cvictor at pchome dot com dot tw
Description:
------------
pathinfo() doesn't handle pathname in multibyte well. This error can be reporduced under big5 and utf-8 charset, no matter converting the whole source php file or using mb_convert_encoding() inline.
This error only occurs when the first character of basename is a Chinese character.

I didn't recompile PHP bin, and modules used seem not relevent. My php.ini is adapted from php.ini-recommended. The OS is a Traditional Chinese version.

Reproduce code:
---------------
<?php
$fp = '/var/????.txt';
var_dump(pathinfo($fp));
$fp = '/var/a????.txt';
var_dump(pathinfo($fp));
?>

Expected result:
----------------
array(3) {
  ["dirname"]=>
  string(4) "/var"
  ["basename"]=>
  string(8) "????.txt"
  ["extension"]=>
  string(3) "txt"
}
array(3) {
  ["dirname"]=>
  string(4) "/var"
  ["basename"]=>
  string(8) "a????.txt"
  ["extension"]=>
  string(3) "txt"
}

Actual result:
--------------
array(3) {
  ["dirname"]=>
  string(4) "/var"
  ["basename"]=>
  string(4) ".txt"
  ["extension"]=>
  string(3) "txt"
}
array(3) {
  ["dirname"]=>
  string(4) "/var"
  ["basename"]=>
  string(8) "a????.txt"
  ["extension"]=>
  string(3) "txt"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-30 03:22 UTC] ppmm at wuxinan dot net
related to bug# 30105
http://bugs.php.net/bug.php?id=30105
 [2004-09-30 03:27 UTC] ppmm at wuxinan dot net
partial summary of bug # 29542 30014 30105:

this bug confirmed to exist on:

simplified chinese windows 2000
traditional chinese windows xp pro
redhat 9 (default rpm's)

this bug confirmed not to exist on:
fedora core 3 test 1 (default rpm's)
english windows xp pro
 [2005-03-07 21:17 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-20 18:04 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 03:01:28 2024 UTC