Re: com php-src: add test for #78185: ext/opcache/tests/bug78185.phpt
| From: | Christoph M. Becker | Date: | Thu, 20 Jun 2019 09:41:37 +0000 |
| Subject: | Re: com php-src: add test for #78185: ext/opcache/tests/bug78185.phpt | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-106939@lists.php.net to get a copy of this message | ||
On 20.06.2019 at 10:38, Remi Collet wrote:
> Commit: a28383c9278757a1923667893355c9e2ec2ddb22
> Author: Remi Collet <remi@php.net> Thu, 20 Jun 2019 10:27:33 +0200
> Parents: d51108d5df7868ec53257bcd7131886a52af1c1f
> Branches: PHP-7.2.20
>
> Link: >—·ì ‡/
> =http://git.php.net/?p=php-src.git;a=commitdiff;h=a28383c9278757a1923667893355c9e2ec2ddb22
>
> Log:
> add test for #78185
>
> (cherry picked from commit 63f2d880888aae381631f126b3ed029b3468f903)
>
> Bugs:
> https://bugs.php.net/78185
>
> Changed paths:
> A ext/opcache/tests/bug78185.phpt
>
>
> Diff:
> diff --git a/ext/opcache/tests/bug78185.phpt b/ext/opcache/tests/bug78185.phpt
> new file mode 100644
> index 0000000..cd96cf8
> --- /dev/null
> +++ b/ext/opcache/tests/bug78185.phpt
> @@ -0,0 +1,22 @@
> +--TEST--
> +Bug #78185: file cache only no longer works
> +--INI--
> +opcache.enable_cli=1
> +opcache.optimization_level=-1
> +opcache.file_cache={PWD}
> +opcache.file_cache_only=1
> +--FILE--
> +<?php
> +foreach (glob(__DIR__ . '/*/' . __DIR__ . '/*.bin') as $p) {
> + var_dump($p);
> +}
> +?>
> +--CLEAN--
> +<?php
> +foreach (glob(__DIR__ . '/*/' . __DIR__ . '/*.bin') as $p) {
> + unlink($p);
> +}
> +?>
> +--EXPECTF--
> +string(%d) "%s78185.php.bin"
> +
Thanks for adding this important test Remi! It won't work on Windows,
though, since there are actually two directories (two MD5 hashes) above
the original folder structure, and the colon after the drive letter is
swallowed. So basically we'd need something like
if (substr(PHP_OS, 0, 3) !== 'WIN') {
$pattern = __DIR__ . '/*/' . __DIR__ . '/*.bin';
} else {
$pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) .
'/*.bin';
}
foreach (glob($pattern) as $p) {
Furthermore, the cleanup section may have potential issues regarding
parallel test execution, since it might unlink unrelated opcache bins.
Even if that is no issue, executing this test leaves file cache
directories in the tests/ directory, so it might be preferable to set
opcache.file_cache={TMP}, and to not clean up at all.
Thanks,
Christoph