bug61546.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #61546 (functions related to current script failed when chdir() in cli sapi)
  3. --FILE--
  4. <?php
  5. // reference doc for getmyinode() on php.net states that it returns an integer or FALSE on error
  6. // on Windows, getmyinode() returns 0 which normally casts to FALSE
  7. // however, the implementation of getmyinode() (in pageinfo.c) returns an explicit FALSE in the
  8. // event that the internal page_inode structure is less than 0, otherwise it returns the long value
  9. // of page_inode. therefore, an explicit 0 should be a passing value for this test.
  10. //
  11. // the ext/standard/tests/file/statpage.phpt test also tests getmyinode() returns an integer and will
  12. // pass even if that integer is 0. on Windows, the getmyinode() call in statpage.phpt returns 0 and
  13. // passes on Windows.
  14. $php = getenv("TEST_PHP_EXECUTABLE");
  15. $test_code = <<<PHP
  16. <?php
  17. chdir('..');
  18. var_dump(get_current_user() != "");
  19. chdir('..');
  20. var_dump(getmyinode() !== false);
  21. var_dump(getlastmod() != false);
  22. PHP;
  23. file_put_contents("bug61546_sub.php", $test_code);
  24. system($php . ' -n bug61546_sub.php');
  25. unlink("bug61546_sub.php");
  26. ?>
  27. --EXPECT--
  28. bool(true)
  29. bool(true)
  30. bool(true)