-
Notifications
You must be signed in to change notification settings - Fork 8k
Add php.ini option to disable stat cache #17178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
billynoah
wants to merge
9
commits into
php:master
Choose a base branch
from
billynoah:Add-php.ini-option-to-disable-stat-cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9ecd9da
Update zend_virtual_cwd.c
billynoah e92c7d0
Update zend_virtual_cwd.h
billynoah d6837fe
Update filestat.c
billynoah 3237da6
Update main.c
billynoah faa89ea
Update php.ini-development
billynoah b5e8a21
Update php.ini-production
billynoah dc2f26c
Create bug28790.cache.phpt
billynoah bf56e4e
Create bug28790.no-cache.phpt
billynoah 2bf2e8f
Update Zend/zend_virtual_cwd.h
billynoah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--TEST-- | ||
Bug #28790: Add php.ini option to disable stat cache (with cache) | ||
--FILE-- | ||
<?php | ||
|
||
$php = '"'.getenv('TEST_PHP_EXECUTABLE').'"'; | ||
$phpfile = getenv('TEST_PHP_EXECUTABLE'); | ||
$impossiblefile = __FILE__.DIRECTORY_SEPARATOR.'bug28790.impossible'; | ||
$testfile = __DIR__.DIRECTORY_SEPARATOR.'bug28790.file'; | ||
|
||
function all_the_stats($filename, $message) { | ||
if (@lstat($filename)) { | ||
print("lstat: $message.\n"); | ||
} | ||
if (@stat($filename)) { | ||
print("stat: $message.\n"); | ||
} | ||
} | ||
|
||
# Windows can use / for dir separators, so let's do that. | ||
$qtestfile = str_replace("\\", "/", "$testfile"); | ||
|
||
# This creates a file and should emit stat & lstat messages. | ||
passthru($php.' -n -r "touch(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists"); | ||
|
||
# This deletes the file and shouldn't emit stat & lstat messages (but does). | ||
passthru($php.' -n -r "unlink(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This stats a non-existent file; still stat/lstats the deleted testfile (shouldn't). | ||
if (!@stat("$impossiblefile")) { | ||
print("stat impossiblefile does not exist.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This is_files an existing file; still can lstat the deleted testfile (shouldn't). | ||
if (is_file("$phpfile")) { | ||
print("is_file(stat): php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This lstats an existing file; finally can't stat or lstat the deleted testfile. | ||
if (lstat("$phpfile")) { | ||
print("lstat: php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
?> | ||
--EXPECT-- | ||
lstat: testfile exists. | ||
stat: testfile exists. | ||
lstat: testfile exists (it shouldn't). | ||
stat: testfile exists (it shouldn't). | ||
stat impossiblefile does not exist. | ||
lstat: testfile exists (it shouldn't). | ||
stat: testfile exists (it shouldn't). | ||
is_file(stat): php binary exists. | ||
lstat: testfile exists (it shouldn't). | ||
lstat: php binary exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--TEST-- | ||
Bug #28790: Add php.ini option to disable stat cache (without cache) | ||
--INI-- | ||
enable_stat_cache = False | ||
--FILE-- | ||
<?php | ||
|
||
$php = '"'.getenv('TEST_PHP_EXECUTABLE').'"'; | ||
$phpfile = getenv('TEST_PHP_EXECUTABLE'); | ||
$impossiblefile = __FILE__.DIRECTORY_SEPARATOR.'bug28790.impossible'; | ||
$testfile = __DIR__.DIRECTORY_SEPARATOR.'bug28790.file'; | ||
|
||
function all_the_stats($filename, $message) { | ||
if (@lstat($filename)) { | ||
print("lstat: $message.\n"); | ||
} | ||
if (@stat($filename)) { | ||
print("stat: $message.\n"); | ||
} | ||
} | ||
|
||
# Windows can use / for dir separators, so let's do that. | ||
$qtestfile = str_replace("\\", "/", "$testfile"); | ||
|
||
# This creates a file and should emit stat & lstat messages. | ||
passthru($php.' -n -r "touch(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists"); | ||
|
||
# This deletes the file and shouldn't emit stat or lstat messages. | ||
passthru($php.' -n -r "unlink(\\"'.$qtestfile.'\\");"'); | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This stats a non-existent file; still no testfile stat or lstat messages. | ||
if (!@stat("$impossiblefile")) { | ||
print("stat impossiblefile does not exist.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This is_files an existing file; still no testfile stat or lstat messages. | ||
if (is_file("$phpfile")) { | ||
print("is_file(stat): php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
# This lstats an existing file; still no testfile stat or lstat messages. | ||
if (lstat("$phpfile")) { | ||
print("lstat: php binary exists.\n"); | ||
} | ||
all_the_stats("$testfile", "testfile exists (it shouldn't)"); | ||
|
||
?> | ||
--EXPECT-- | ||
lstat: testfile exists. | ||
stat: testfile exists. | ||
stat impossiblefile does not exist. | ||
is_file(stat): php binary exists. | ||
lstat: php binary exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.