ID:               28338
 User updated by:  mzajonc at pomona dot edu
 Reported By:      mzajonc at pomona dot edu
 Status:           Bogus
 Bug Type:         CGI related
 Operating System: Linux Redhat 7.2
 PHP Version:      5.0.0RC2
 New Comment:

My bad.  I was comparing CGI with CLI.  I was previously using the CGI
php4 as command line tool.


Previous Comments:
------------------------------------------------------------------------

[2004-05-09 20:24:46] [EMAIL PROTECTED]

This is expected behaviour with the CLI version of PHP.

------------------------------------------------------------------------

[2004-05-09 19:57:46] mzajonc at pomona dot edu

Description:
------------
It appears that when running php from the command line relative paths
such as require("../include/test.php") do not function the same in
php4.2.3 and php5.0.0RC2.  Relative paths in php5 are computed relative
to the current directory not relative to the script.

This causes commands (typically run in crontab) like php -f
/www/foo/bar/test.php to break if test.php has require/include
statements that are relative.

Reproduce code:
---------------
The test script (located: /www/www.test.com/test/test.php):

<?php
echo realpath("../test/test.php")
?>

>From command line:
$ cd /www
$ php -f /www/www.test.com/test/test.php


Expected result:
----------------
/www/www.test.com/test/test.php


Actual result:
--------------
When php4 is used, the output is as expected.

When php5 is used, realpath fails and returns FALSE.  It appears to
consider realpath("../test/test.php") to be "/test/test.php" (given
current directory of /www).  However, if you do "cd
/www/www.test.com/test" and then run the same command, the realpath
returns what is expected (since script location is the same as the
current directory).



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28338&edit=1

Reply via email to