Commit: 0a00d292569a8fbd2d5c96c9d141b23ae916f00b Author: Dmitry Stogov <dmi...@zend.com> Mon, 25 Mar 2013 13:05:16 +0400 Parents: 64b029af0dc7d044586db9a554e0a47783076cc8 Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0a00d292569a8fbd2d5c96c9d141b23ae916f00b Log: Fixed bug #64482 (Opcodes for dynamic includes should not be cached) Bugs: https://bugs.php.net/64482 Changed paths: M ext/opcache/ZendAccelerator.c A ext/opcache/tests/bug64482.inc A ext/opcache/tests/bug64482.phpt Diff: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 9d1fdce..bfe9d67 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -134,6 +134,12 @@ static inline int is_stream_path(const char *filename) return ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')); } +static inline int is_cachable_stream_path(const char *filename) +{ + return memcmp(filename, "file://", sizeof("file://") - 1) == 0 || + memcmp(filename, "phar://", sizeof("file://") - 1) == 0; +} + /* O+ overrides PHP chdir() function and remembers the current working directory * in ZCG(cwd) and ZCG(cwd_len). Later accel_getcwd() can use stored value and * avoid getcwd() call. @@ -1373,7 +1379,9 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int !ZCG(enabled) || !accel_startup_ok || (!ZCG(counted) && !ZCSG(accelerator_enabled)) || CG(interactive) || - (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C))) { + (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) || + (is_stream_path(file_handle->filename) && + !is_cachable_stream_path(file_handle->filename))) { /* The Accelerator is disabled, act as if without the Accelerator */ return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); } diff --git a/ext/opcache/tests/bug64482.inc b/ext/opcache/tests/bug64482.inc new file mode 100644 index 0000000..e3d2b21 --- /dev/null +++ b/ext/opcache/tests/bug64482.inc @@ -0,0 +1,2 @@ +<?php +echo "Dynamic include"; diff --git a/ext/opcache/tests/bug64482.phpt b/ext/opcache/tests/bug64482.phpt new file mode 100644 index 0000000..fa722f6 --- /dev/null +++ b/ext/opcache/tests/bug64482.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #64482 (Opcodes for dynamic includes should not be cached) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +include 'bug64482.inc'; +echo "\n"; +include 'php://filter/read=string.toupper/resource=bug64482.inc'; +echo "\n"; +?> +--EXPECT-- +Dynamic include +DYNAMIC INCLUDE -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php