From: mybugs at 163 dot com
Operating system: Microsoft Windows Server 2003 R2
PHP version: 5.4.4
Package: Safe Mode/open_basedir
Bug Type: Bug
Bug description:Excuse me, is this a bug?
Description:
------------
php.ini
[PATH= "D:/Web/test.com/public"]
open_basedir ="D:/Web/test.com/public/"
Test script:
---------------
<?php
echo 'open_basedir:'.ini_get('open_basedir').'<br />'; //D:\WEB\TEST_COM\
$cmd = 'ping qq.com';
echo execute('system',$cmd);
echo execute('passthru',$cmd);
echo execute('shell_exec',$cmd);
echo execute('exec',$cmd);
echo execute('popen',$cmd);
function execute($type,$cfe) {
$data = '';
if ($cfe) {
if($type=='system') {
@ob_start();
@system($cfe);
$data = @ob_get_contents();
@ob_end_clean();
} elseif($type=='passthru') {
@ob_start();
@passthru($cfe);
$data = @ob_get_contents();
@ob_end_clean();
} elseif($type=='shell_exec') {
$data = @shell_exec($cfe);
} elseif($type=='exec') {
@exec($cfe,$data);
$data = join("\n",$data);
} elseif($type=='popen') {
$f = @popen($cfe,"r");
while(!@feof($f)) {
$data .= @fread($f,1024);
}
@pclose($f);
}
}
return $type.'----------<br />'.$data.'<br />'.$type.'----------<br
/><br
/>';
}
?>
Expected result:
----------------
open_basedir:D:\Web\test.com\public\
system----------
system----------
passthru----------
Pinging qq.com [119.147.15.13] with 32 bytes of data: Reply from
119.147.15.13: bytes=32 time=11ms TTL=56 Reply from 119.147.15.13: bytes=32
time=11ms TTL=56 Reply from 119.147.15.13: bytes=32 time=11ms TTL=56 Reply
from 119.147.15.13: bytes=32 time=11ms TTL=56 Ping statistics for
119.147.15.13: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 11ms, Maximum =
11ms, Average = 11ms
passthru----------
shell_exec----------
Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from
119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32
time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply
from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for
119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum =
9ms, Average = 9ms
shell_exec----------
exec----------
Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from
119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32
time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply
from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for
119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum =
9ms, Average = 9ms
exec----------
popen----------
Pinging qq.com [119.147.15.17] with 32 bytes of data: Reply from
119.147.15.17: bytes=32 time=9ms TTL=56 Reply from 119.147.15.17: bytes=32
time=9ms TTL=56 Reply from 119.147.15.17: bytes=32 time=9ms TTL=56 Reply
from 119.147.15.17: bytes=32 time=9ms TTL=56 Ping statistics for
119.147.15.17: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 9ms, Maximum =
9ms, Average = 9ms
popen----------
Actual result:
--------------
open_basedir:D:\Web\test.com\public\
system----------
system----------
passthru----------
passthru----------
shell_exec----------
shell_exec----------
exec----------
exec----------
popen----------
popen----------
--
Edit bug report at https://bugs.php.net/bug.php?id=62457&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62457&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62457&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62457&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62457&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62457&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62457&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62457&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62457&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62457&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62457&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62457&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62457&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62457&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62457&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62457&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62457&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62457&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62457&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62457&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62457&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62457&r=mysqlcfg