3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // no separator $dir = '/tmp/'; ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } var_dump(file_put_contents('/tmp/hhvm-openbasedir-test', 'some data')); // with separator $dir = dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } // with separator $dir = '/tmp/'.PATH_SEPARATOR.dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); }
based on ig6PY
Output for 5.4.34 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 10 int(9) ini_set to /usr/bin Opened! Notice: Undefined variable: fb in /in/MNTuo on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 21 ini_set to /tmp/:/usr/bin Opened! Notice: Undefined variable: fb in /in/MNTuo on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 31
Output for 5.4.0 - 5.4.32
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 10 int(9) Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 16 ini_set to /usr/bin Opened! Notice: Undefined variable: fb in /in/MNTuo on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 21 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 26 ini_set to /tmp/:/usr/bin Opened! Notice: Undefined variable: fb in /in/MNTuo on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 31
Output for 5.3.0 - 5.3.29
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 10 int(9) Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 15 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/MNTuo on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 25 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/MNTuo on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/MNTuo on line 31
Output for 5.0.4 - 5.2.17
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 int(9) Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 15 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/MNTuo on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 25 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/MNTuo on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 31
Output for 5.0.0 - 5.0.3
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 int(9) Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 15 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/MNTuo on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/MNTuo on line 25 Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/MNTuo on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 31
Output for 4.4.5 - 4.4.9
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 Fatal error: Call to undefined function: file_put_contents() in /in/MNTuo on line 12
Process exited with code 255.
Output for 4.3.5 - 4.4.4
Warning: ini_set() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 Fatal error: Call to undefined function: file_put_contents() in /in/MNTuo on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: ini_set,pcntl_fork() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 Fatal error: Call to undefined function: file_put_contents() in /in/MNTuo on line 12
Process exited with code 255.
Output for 4.3.1
Warning: ini_set,pcntl_fork() has been disabled for security reasons in /in/MNTuo on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 Fatal error: Call to undefined function: file_put_contents() in /in/MNTuo on line 12
Output for 4.3.0
ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/MNTuo on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/MNTuo on line 10 Fatal error: Call to undefined function: file_put_contents() in /in/MNTuo on line 12