ID: 46070
Comment by: dougcsd at yahoo dot com
Reported By: dougcsd at yahoo dot com
Status: Open
Bug Type: Filesystem function related
Operating System: BlueWhite64
PHP Version: 5.3.0alpha2
New Comment:
Minor code change produced a correct result. Appears the issue is
related to more than three levels up. Just so happends that this is
also the safe mode chroot directory:
/var/www/html/
<Directory "/var/www/html">
AddType application/x-httpd-php .php
php_admin_flag safe_mode on
# php_flag assert.warning off
# php_admin_flag assert.warning off
php_admin_value safe_mode_exec_dir /var/www/html/
php_admin_value open_basedir /var/www/html/
$osd_root_path2 = realpath(dirname(__FILE__) . '/../../') . '/';
$dump=fopen("/var/www/html/chat/dumptest","w");
fprintf($dump,"%s\n%s\n",dirname(__FILE__),$osd_root_path2);
fclose($dump);
/var/www/html/chat/inc/cmses
/var/www/html/chat/
Previous Comments:
------------------------------------------------------------------------
[2008-09-13 12:09:27] dougcsd at yahoo dot com
Description:
------------
This code segment runs in a file included from an upper level script.
The same script appears to work correctly when PHP is compiled with the
same options on a 32 bit OS.
Apache 2.2 compiled from source
All php compiled from source
Linux kernel 2.6.26.2 compiled from source.
libc:
-rwxr-xr-x 1 root root 1658189 2008-04-22 03:51 libc-2.7.so*
lrwxrwxrwx 1 root root 11 2008-06-17 18:22 libc.so.6 ->
libc-2.7.so*
[EMAIL PROTECTED]:/lib# gcc --version
gcc (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/my
sql --with-zlib --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr
--prefix=/usr
/local/php5 --enable-mbstring
Code:
$osd_root_path2 = realpath(dirname(__FILE__) . '/../../../') . '/';
$dump=fopen("/var/www/html/chat/dumptest","w");
fprintf($dump,"%s\n%s\n",dirname(__FILE__),$osd_root_path2);
fclose($dump);
The file output was the same on 5.2.6 through 5.3.Alpha3
Output when safe mode is on:
/var/www/html/chat/inc/cmses
/
Output when safe mode is off:
/var/www/html/chat/inc/cmses
/var/www/html/
Reproduce code:
---------------
$osd_root_path2 = realpath(dirname(__FILE__) . '/../../../') . '/';
$dump=fopen("/var/www/html/chat/dumptest","w");
fprintf($dump,"%s\n%s\n",dirname(__FILE__),$osd_root_path2);
fclose($dump);
Expected result:
----------------
Output when safe mode is off:
/var/www/html/chat/inc/cmses
/var/www/html/
Actual result:
--------------
Output when safe mode is on:
/var/www/html/chat/inc/cmses
/
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46070&edit=1