From:             carsten_sttgt at gmx dot de
Operating system: Windows_NT
PHP version:      5.2.5
PHP Bug Type:     Filesystem function related
Bug description:  backward compatibility break in realpath()

Description:
------------
Hello,

regarding Bug #42778, I think should give a better explanation, why there
was a break in backward compatibility in the function realpath() on windows
between PHP 5.2.3 and 5.2.4, without any information in the manual or
changelog.

Additional, in the manual you can read:
| The resulting path will have no symbolic link,
| '/./' or '/../' components.

A "/./" as last component in a path, is the same as "/" as last component.
And thus the last "/" must be removed.

As you can see, the results with PHP 4.4.7(Win), PHP <=5.2.3(Win) and PHP
5.2.5(FreeBSD) are the same and like descriped in the manual.

Only with PHP >=5.2.3(Win) you have a different result.

The DirectoryIterator also have the same behaviour with all OS and
versions.

(BTW: With Perl or VBS I have also no trailing slash on Windows)

Regards,
Carsten

BTW: You should not forget:
For an PHP programer it's necessary, to have the same results in PHP
functions between PHP versions and operating systems. (especially without
informations)


Reproduce code:
---------------
Testscripts are executed with (in the given dirs):
$ .\php -n test.php

Testscript 1 in C:\php5
<?php
  echo realpath('extras\\mibs\\');
?>

Testscript 2 in C:\php4
<?php
  echo realpath('extras\\mibs\\');
?>


Testscript 3 in C:\php5
<?php
  $dir = new DirectoryIterator('extras\\mibs\\');
  echo $dir->getRealPath();
?>


Testscripts are executed with (in the given dirs):
$ ./php -n test.php

Testscript 4 in /usr/local/bin (with FreeBSD)
<?php
  echo realpath('../include/');
?>

Testscript 5 in /usr/local/bin (with FreeBSD)
<?php
  $dir = new DirectoryIterator('../include/');
  echo $dir->getRealPath();
?>


Expected result:
----------------
on Windows with PHP5:
C:\php5\extras\mibs

on Windows with PHP4:
C:\php4\extras\mibs

on FreeBSD:
/usr/local/include



Actual result:
--------------
Testscript 1 with PHP 5.2.3:
C:\php5\extras\mibs

Testscript 2 with PHP 4.4.7 (Win):
C:\php4\extras\mibs

Testscript 1 with PHP 5.2.4 (Win):
C:\php5\extras\mibs\

Testscript 1 with PHP 5.2.5 (Win):
C:\php5\extras\mibs\

Testscript 3 with PHP 5.2.5 (Win):
C:\php5\extras\mibs

Testscript 4 with PHP 5.2.5 (FreeBSD):
/usr/local/include

Testscript 5 with PHP 5.2.5 (FreeBSD):
/usr/local/include


-- 
Edit bug report at http://bugs.php.net/?id=43248&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43248&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43248&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43248&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43248&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43248&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43248&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43248&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43248&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43248&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43248&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43248&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43248&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43248&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43248&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43248&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43248&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43248&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43248&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43248&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43248&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43248&r=mysqlcfg

Reply via email to