Closed degtyaryov closed 11 years ago
confirm this bug, the fix is straightforward:
$ git diff
diff --git a/ZendAccelerator.c b/ZendAccelerator.c
index b62f245..de3feb7 100644
--- a/ZendAccelerator.c
+++ b/ZendAccelerator.c
@@ -1062,6 +1062,10 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc
realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC);
#endif
+ if (!realpath) {
+ return FAILURE;
+ }
+
persistent_script = zend_accel_hash_find(&ZCSG(hash), realpath, strlen(realpath) + 1);
if (persistent_script && !persistent_script->corrupted) {
zend_file_handle file_handle;
The patch is committed.
I cannot reopen this issue, but the fix causes segfaults in PHP 5.3.27 on Centos 5.
False alarm. The segfaults were caused by not restarting Apache after recompiling OPcache.
Hello.
fedora 19, php 5.5.3
$ cat test.php <?php echo opcache_invalidate('1'); ?>
$ php test.php Segmentation fault
or
$ cat test.php <?php echo opcache_invalidate('./test.php'); ?> $ php test.php Segmentation fault
(gdb) bt
0 __strlen_sse2_pminub () at ../sysdeps/x86_64/multiarch/strlen-sse2-pminub.S:38
1 0x00007fffed56aeda in zend_accel_invalidate (filename=, filename_len=1, force=) at /usr/src/debug/php-5.5.3/ext/opcache/ZendAccelerator.c:1065
2 0x00007fffed56da03 in zif_opcache_invalidate (ht=, return_value=0x7ffff7fd3a90, return_value_ptr=, this_ptr=, return_value_used=)
3 0x00005555557714fb in dtrace_execute_internal (execute_data_ptr=, fci=, return_value_used=) at /usr/src/debug/php-5.5.3/Zend/zend_dtrace.c:99
4 0x0000555555831245 in zend_do_fcall_common_helper_SPEC (execute_data=) at /usr/src/debug/php-5.5.3/Zend/zend_vm_execute.h:545
5 0x00005555557ab0b8 in execute_ex (execute_data=0x7ffff7fa1080) at /usr/src/debug/php-5.5.3/Zend/zend_vm_execute.h:356
6 0x00005555557713d9 in dtrace_execute_ex (execute_data=) at /usr/src/debug/php-5.5.3/Zend/zend_dtrace.c:75
7 0x0000555555782e30 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-5.5.3/Zend/zend.c:1316
8 0x0000555555722b05 in php_execute_script (primary_file=primary_file@entry=0x7fffffffd1f0) at /usr/src/debug/php-5.5.3/main/main.c:2484
9 0x0000555555833258 in do_cli (argc=2, argv=0x555555b81a60) at /usr/src/debug/php-5.5.3/sapi/cli/php_cli.c:994
10 0x000055555560dc50 in main (argc=2, argv=0x555555b81a60) at /usr/src/debug/php-5.5.3/sapi/cli/php_cli.c:1378
For full path to file all coorect
$ cat test.php <?php echo opcache_invalidate('/tmp/test.php'); ?>
$ php test.php 1
This should not be.