|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-10-06 15:11 UTC] deivid dot garcia dot garcia at gmail dot com
[2015-10-06 15:15 UTC] deivid dot garcia dot garcia at gmail dot com
[2015-10-07 14:06 UTC] ab@php.net
-Status: Open
+Status: Not a bug
[2015-10-07 14:06 UTC] ab@php.net
[2015-10-07 14:32 UTC] deivid dot garcia dot garcia at gmail dot com
[2015-10-07 14:53 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Description: ------------ is_dir and is_file are returning inconsistent results when being called from code registered by register_shutdown_function(). Test script: --------------- <?php function printline($line) { echo $line . "<br/>\r\n"; } function _is_dir($dir) { printline("is_dir({$dir}): " . (is_dir($dir) ? "true" : "false")); } function _is_file($file) { printline("is_file({$file}): " . (is_file($file) ? "true" : "false")); } global $test; $test = 1; function test_dir() { global $test; printline("workding directory:" . getcwd()); // sites/all is a regular directory in the webroot _is_dir('sites/all'); // sites/default is a symlink directory in the webroot _is_dir('sites/default'); // index.php is where this script in the webroot _is_file('index.php'); if ($test == 2) { // php.exe not in webroot _is_file('php.exe'); // cron.php is a file in the webroot _is_file('cron.php'); } } test_dir(); printline("shutdown"); register_shutdown_function('test_dir'); return; Expected result: ---------------- When $test == 1 Actual output: workding directory:D:\REPOSITORIOS_SABENTIS\drupal7 is_dir(sites/all): true is_dir(sites/default): true is_file(index.php): true shutdown workding directory:C:\Program Files (x86)\PHP\php5.6 is_dir(sites/all): false is_dir(sites/default): false is_file(index.php): true Expected Output: workding directory:D:\REPOSITORIOS_SABENTIS\drupal7 is_dir(sites/all): true is_dir(sites/default): true is_file(index.php): true shutdown workding directory:C:\Program Files (x86)\PHP\php5.6 is_dir(sites/all): false is_dir(sites/default): false is_file(index.php): false When $test == 2 Actual Output = Expected Output: workding directory:D:\REPOSITORIOS_SABENTIS\drupal7 is_dir(sites/all): true is_dir(sites/default): true is_file(index.php): true is_file(php.exe): false is_file(cron.php): true shutdown workding directory:C:\Program Files (x86)\PHP\php5.6 is_dir(sites/all): false is_dir(sites/default): false is_file(index.php): false is_file(php.exe): true is_file(cron.php): false