]> granicus.if.org Git - php/commitdiff
Fix #73546: Logging for opcache has an empty file name
authorMitch Hagstrand <mhagstrand@gmail.com>
Wed, 16 Nov 2016 20:00:52 +0000 (12:00 -0800)
committerNikita Popov <nikic@php.net>
Wed, 16 Nov 2016 20:30:40 +0000 (21:30 +0100)
NEWS
ext/opcache/ZendAccelerator.c
ext/opcache/tests/basic_logging.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index d1644577111c9e9dd99b5afc1d1a0d43ddcab827..b4c3249efa3e4a32459dfd437c6c62d334aca56f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,7 +17,8 @@ PHP                                                                        NEWS
     (Anatol)
 
 - Opcache:
-  . Fixed bug #69090 (check cached files permissions)
+  . Fixed bug #69090 (check cached files permissions). (dmitry)
+  . Fixed bug #73546 (Logging for opcache has an empty file name). (mhagstrand)
 
 - PCRE:
   . Fixed bug #73392 (A use-after-free in zend allocator management). 
index 11724c4eda359f4ecc200070a18fd7687140e84b..230cc3d20c0a84b87d0a1b78b146a8e8a7f4ff76 100644 (file)
@@ -1339,7 +1339,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
        /* store script structure in the hash table */
        bucket = zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(new_persistent_script->full_path), ZSTR_LEN(new_persistent_script->full_path), 0, new_persistent_script);
        if (bucket) {
-               zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->full_path);
+               zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", ZSTR_VAL(new_persistent_script->full_path));
                if (key &&
                    /* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
                    memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
@@ -1806,7 +1806,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
                if (checksum != persistent_script->dynamic_members.checksum ) {
                        /* The checksum is wrong */
                        zend_accel_error(ACCEL_LOG_INFO, "Checksum failed for '%s':  expected=0x%0.8X, found=0x%0.8X",
-                                                        persistent_script->full_path, persistent_script->dynamic_members.checksum, checksum);
+                                                        ZSTR_VAL(persistent_script->full_path), persistent_script->dynamic_members.checksum, checksum);
                        zend_shared_alloc_lock();
                        if (!persistent_script->corrupted) {
                                persistent_script->corrupted = 1;
diff --git a/ext/opcache/tests/basic_logging.phpt b/ext/opcache/tests/basic_logging.phpt
new file mode 100644 (file)
index 0000000..c62ea03
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Test basic logging for the Opcache
+--DESCRIPTION--
+This test runs a simple PHP script and ensures the Opcache 
+outputs the correct logging at the highest log_verbosity_level
+
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.log_verbosity_level=4
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+echo "Foo Bar\n";
+?>
+--EXPECTF--
+%s Message Cached script '%sbasic_logging%s'
+Foo Bar