Hi, The attached patch for PHP_5_3 is going to provide general solution to control some aspects of PHP compilation. It is absolutely necessary for all opcode caches to make cached scripts work exactly in the same way as non-cached. The problem occurs because early binding of inherited classes is not possible for cached scripts. As result inheritance is handled in run-time and classes might be created in wrong order. Most opcode caches do some tricks to resolve this issue, but all of them fail to do it right way.
The patch introduces CG(compiler_options), which is a set of compiler flags that can be used by some extensions as opcode caches and debuggers. Such flags change the process of compilation a bit. For example to solve inherence early binding problem the opcode cache need to compile file with additional flags extension_compile_file() { ... orig_compiler_options = CG(compiler_options); CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING; orig_compile_file(); CG(compiler_options) = orig_compiler_options; ... } And then during restoration from cache call zend_do_delayed_early_binding(). This way even with cache all classes will be created exactly in the same order. The same CG(compiler_options) might be used to change other aspects of compilation in the future. The patch also optimizes ZEND_FETCH_CLASS+ZEND_ADD_INTERFACE opcodes into single ZEND_ADD_INTERFACE, and makes verification of abstract classes with interfaces only once. I'm going to commit the patch on Monday or Tuesday. Thanks. Dmitry.
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php