-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix TestCase::expectErrorLog() with open_basedir php.ini #6208
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
base: 12.1
Are you sure you want to change the base?
Conversation
tests/end-to-end/generic/expect-error-log-fail-with-open_basedir.phpt
Outdated
Show resolved
Hide resolved
* - https://github.com/php/php-src/issues/17817 | ||
* - https://github.com/php/php-src/issues/18530 | ||
* | ||
* Until then, ignore TestCase::expectErrorLog() if open_basedir php.ini is in effect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring expectations sounds like a bad idea.. maybe we should turn such a test "risky" and/or can introduce a warning telling the author of the test, that not everything worked according to plan.
siltent ignore sounds like a bad idea.
I guess @sebastianbergmann has an opinion on that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
"incomplete" should be the right status. If error_log file could not be created, test would still complete but will be marked as incomplete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the "throw incomplete exception" be moved then into TestCase::runBare to always run https://github.com/sebastianbergmann/phpunit/blob/12.1.5/src/Framework/TestCase.php#L500-L502?
Another option is to revert/remove the newly introduced TestCase::expectErrorLog()
until php-src allows to check it without temporary file. Currently, it suffers not only the issue here, but it is also not the fastest to having to create temporary file before each TestCase run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is also not the fastest to having to create temporary file before each TestCase run.
please share a benchmark which proves your claim - noone else reported something like that since the change was released. how big is the impact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<?php
$t1 = 0;
$t2 = 0;
for ($i = 0; $i < 1000; ++$i) {
$ts = microtime(true);
$capture = tmpfile();
$ts2 = microtime(true);
$t1 += $ts2 - $ts;
$path = stream_get_meta_data($capture)['uri'];
$t2 += microtime(true) - $ts2;
}
var_dump($t1 / $i);
var_dump($t2 / $i);
T2 does not call any FS, T1 is about 0.4 ms / per iteration (TestCase run).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean a real world impact, not microbenchmarks.
I am aware that not running stuff is faster then running stuff, but thats not helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another words about 1 second extra time per 2500 tests :)
This is the real world overhead of requiring FS.
Let @sebastianbergmann decide this thread incl. what to throw.
I hope to find the time to look into this within the next week. |
fix #6197