From: michael202 at gmx dot de Operating system: Windows only PHP version: 5.2.3 PHP Bug Type: Streams related Bug description: is_dir() truncates dirs when using UNC paths
Description: ------------ calling is_dir() with an UNC path truncates each part of the path. The last character is missing. This results in unnecessary errors (on the host side) and slowdowns (on client side). Reproduce code: --------------- windows only (php 5.2.3, Windows XP with cmd.exe) and linux host. <?php $p = '\\hostA\volumeB\dirC'; echo(is_dir($p) . "\n"); and then trace network IO for service/port SMB. Beware of posssible side effects though caching of SMB connections Expected result: ---------------- no error messages in /var/log/messages on 'hostA' Actual result: -------------- I traced these SMB Commands sent over the network: Connect AndX Request \\hostA\IPC$ Connect AndX Request \\hostA\volume -> STATUS_BAD_NETWORK_NAME FindFirst2, Pattern: \dir these are in /var/log/messages in 'hostA' ... smbd/service.c:make_connection(252) ... couldn't find service volume I think this is another problem with tsrm_virtual_cwd.c where around line 500 state_cwd_length is set to 2 if a slash is found at the beginning. Perhaps the existence of UNC paths is not checked for. -- Edit bug report at http://bugs.php.net/?id=42096&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42096&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42096&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42096&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42096&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42096&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42096&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42096&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42096&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42096&r=support Expected behavior: http://bugs.php.net/fix.php?id=42096&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42096&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42096&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42096&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42096&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42096&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42096&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42096&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42096&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42096&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42096&r=mysqlcfg