mirror of
https://github.com/php/php-src.git
synced 2026-04-27 10:16:41 +02:00
52730fa30a
This test reveals a difference between TS and NTS through all the versions, which is probably too late to fix at this stage of 7.3. While NTS always relies on the system getcwd(), TS uses a fake CWD which might get out of sync when the real dir is deleted. Thus, skip test on unsuitable build. Investigate possibilities to fix this edge case for later versions.
40 lines
682 B
PHP
40 lines
682 B
PHP
--TEST--
|
|
Bug #77484 Zend engine crashes when calling realpath in invalid working dir
|
|
--SKIPIF--
|
|
<?php
|
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
|
die("skip can't remove CWD on Windows");
|
|
}
|
|
if (PHP_ZTS) {
|
|
/* TODO eliminate difference in TS build. */
|
|
die("skip Not for ZTS");
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$old_cwd = getcwd();
|
|
|
|
mkdir(__DIR__ . "/foo");
|
|
chdir(__DIR__ . "/foo");
|
|
rmdir(__DIR__ . "/foo");
|
|
|
|
// Outputs: / (incorrect)
|
|
$new_cwd = getcwd();
|
|
|
|
// Outputs: false (correct)
|
|
$rp0 = realpath('');
|
|
|
|
// Crash
|
|
$rp1 = realpath('.');
|
|
$rp2 = realpath('./');
|
|
|
|
var_dump($old_cwd, $new_cwd, $rp0, $rp1, $rp2);
|
|
?>
|
|
--EXPECTF--
|
|
string(%d) "%s"
|
|
bool(false)
|
|
bool(false)
|
|
string(1) "."
|
|
string(1) "."
|