From fae0a738df8542d909c4e56b4af89abcfbc2f99e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 5 Mar 2013 14:57:50 +0400 Subject: [PATCH] Fixed bug #64353 (Built-in classes can be unavailable with dynamic includes and Optimizer+) --- ZendAccelerator.c | 14 ++++++++++++++ tests/bug64353.phpt | 29 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/bug64353.phpt diff --git a/ZendAccelerator.c b/ZendAccelerator.c index e0576b8a0c..aa226706ec 100644 --- a/ZendAccelerator.c +++ b/ZendAccelerator.c @@ -1207,6 +1207,20 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han return NULL; } +#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO + if (file_handle->type == ZEND_HANDLE_STREAM) { + char *buf; + size_t size, offset = 0; + + /* Stream callbacks needs to be called in context of original + * function and class tables (see: https://bugs.php.net/bug.php?id=64353) + */ + if (zend_stream_fixup(file_handle, &buf, &size TSRMLS_CC) == FAILURE) { + return NULL; + } + } +#endif + new_persistent_script = create_persistent_script(); /* Save the original values for the op_array, function table and class table */ diff --git a/tests/bug64353.phpt b/tests/bug64353.phpt new file mode 100644 index 0000000000..32e70cc35e --- /dev/null +++ b/tests/bug64353.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #64353 (Built-in classes can be unavailable with dynamic includes and Optimizer+) +--INI-- +zend_optimizerplus.enable=1 +zend_optimizerplus.enable_cli=1 +--SKIPIF-- + +--FILE-- +data = strtoupper($bucket->data); + $consumed += $bucket->datalen; +// stream_bucket_append($out, $bucket); + } + return PSFS_PASS_ON; + } +} + +stream_filter_register('bug.test', 'BugLoader'); +include "php://filter/read=bug.test/resource=test.php"; +echo "OK\n"; +?> +--EXPECT-- +OK -- 2.40.0