com php-src: Fix #73546: Logging for opcache has an empty file name: NEWS ext/opcache/ZendAccelerator.c ext/opcache/tests/basic_logging .phpt
| From: | Nikita Popov | Date: | Wed, 16 Nov 2016 20:30:40 +0000 |
| Subject: | com php-src: Fix #73546: Logging for opcache has an empty file name: NEWS ext/opcache/ZendAccelerator.c ext/opcache/tests/basic_logging .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95807@lists.php.net to get a copy of this message | ||
Commit: 1d8be7c044c0e4a7d985e7b02fe81644a636542d
Author: Mitch Hagstrand <mhagstrand@gmail.com> Wed, 16 Nov 2016 12:00:52 -0800
Committer: Nikita Popov <nikic@php.net> Wed, 16 Nov 2016 21:30:40 +0100
Parents: 71ee641327539c3f681c6c333e69f2531efacc3c
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1d8be7c044c0e4a7d985e7b02fe81644a636542d
Log:
Fix #73546: Logging for opcache has an empty file name
Bugs:
https://bugs.php.net/73546
Changed paths:
M NEWS
M ext/opcache/ZendAccelerator.c
A ext/opcache/tests/basic_logging.phpt
Diff:
diff --git a/NEWS b/NEWS
index d164457..b4c3249 100644
--- 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).
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 11724c4e..230cc3d 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -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
index 0000000..c62ea03
--- /dev/null
+++ b/ext/opcache/tests/basic_logging.phpt
@@ -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