Skip to content

Commit d750ae0

Browse files
committed
Merge branch 'opcache/opcache_is_script_cached_file' of https://github.com/iamacarpet/php-src into opcache/opcache_is_script_cached_file
2 parents f9c05a1 + 9346db9 commit d750ae0

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

ext/opcache/tests/cleanup_helper.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
function removeDirRecursive($dir) {
4+
if (!is_dir($dir)) return;
5+
try {
6+
$iterator = new RecursiveIteratorIterator(
7+
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
8+
RecursiveIteratorIterator::CHILD_FIRST
9+
);
10+
foreach ($iterator as $fileinfo) {
11+
if ($fileinfo->isDir()) {
12+
@rmdir($fileinfo->getRealPath());
13+
} else {
14+
@unlink($fileinfo->getRealPath());
15+
}
16+
}
17+
@rmdir($dir);
18+
} catch (UnexpectedValueException $e) { @rmdir($dir); } catch (Exception $e) { @rmdir($dir); }
19+
}

ext/opcache/tests/gh16979_check_file_cache_function.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var_dump(opcache_is_script_cached_in_file_cache(__FILE__));
3333
?>
3434
--CLEAN--
3535
<?php
36-
require __DIR__ . '/cleanup_helper.inc.php'
36+
require __DIR__ . '/cleanup_helper.inc';
3737

3838
$baseCacheDir = __DIR__ . '/gh16979_cache';
3939

ext/opcache/zend_accelerator_module.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,27 +368,21 @@ static int filename_is_in_cache(zend_string *filename)
368368

369369
static int filename_is_in_file_cache(zend_string *filename)
370370
{
371-
zend_string *realpath;
372-
373-
realpath = zend_resolve_path(filename);
374-
371+
zend_string *realpath = zend_resolve_path(filename);
375372
if (!realpath) {
376373
return 0;
377374
}
378375

379376
zend_file_handle handle;
380-
381377
zend_stream_init_filename_ex(&handle, filename);
382378
handle.opened_path = realpath;
383379

384380
zend_persistent_script *result = zend_file_cache_script_load_ex(&handle, true);
385-
386381
zend_destroy_file_handle(&handle);
387382

388383
return result != NULL;
389384
}
390385

391-
392386
static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS)
393387
{
394388
if (ZEND_NUM_ARGS() == 1) {

0 commit comments

Comments
 (0)