mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.2'
This commit is contained in:
commit
2cab4874ad
4 changed files with 57 additions and 1 deletions
|
@ -3281,7 +3281,10 @@ ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_
|
|||
if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
|
||||
ce->refcount++;
|
||||
}
|
||||
// avoid notifying at MINIT time
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
zend_observer_class_linked_notify(ce, lcname);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "zend_inheritance.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_mmap.h"
|
||||
#include "zend_observer.h"
|
||||
#include "main/php_main.h"
|
||||
#include "main/SAPI.h"
|
||||
#include "main/php_streams.h"
|
||||
|
@ -4480,6 +4481,7 @@ static int accel_preload(const char *config, bool in_child)
|
|||
script->script.main_op_array.fn_flags |= ZEND_ACC_DONE_PASS_TWO;
|
||||
script->script.main_op_array.last = 1;
|
||||
script->script.main_op_array.last_literal = 1;
|
||||
script->script.main_op_array.T = ZEND_OBSERVER_ENABLED;
|
||||
#if ZEND_USE_ABS_CONST_ADDR
|
||||
script->script.main_op_array.literals = (zval*)emalloc(sizeof(zval));
|
||||
#else
|
||||
|
|
13
ext/zend_test/tests/observer_preload.inc
Normal file
13
ext/zend_test/tests/observer_preload.inc
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Foo {
|
||||
public static function test() {
|
||||
return "foo::test";
|
||||
}
|
||||
}
|
||||
|
||||
if (true) {
|
||||
function foo() {
|
||||
return 'I should be observable';
|
||||
}
|
||||
}
|
38
ext/zend_test/tests/observer_preload.phpt
Normal file
38
ext/zend_test/tests/observer_preload.phpt
Normal file
|
@ -0,0 +1,38 @@
|
|||
--TEST--
|
||||
Observer: Test with basic preloading
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
opcache
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/observer_preload.inc
|
||||
zend_test.observer.enabled=1
|
||||
zend_test.observer.observe_all=1
|
||||
zend_test.observer.observe_declaring=1
|
||||
zend_test.observer.show_return_value=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
Foo::test();
|
||||
foo();
|
||||
|
||||
echo 'Done' . PHP_EOL;
|
||||
?>
|
||||
--EXPECTF--
|
||||
<!-- declared class 'foo' -->
|
||||
<!-- init '%sobserver_preload.inc' -->
|
||||
<file '%sobserver_preload.inc'>
|
||||
<!-- declared function 'foo' -->
|
||||
</file '%sobserver_preload.inc'>
|
||||
<!-- init '%sobserver_preload.php' -->
|
||||
<file '%sobserver_preload.php'>
|
||||
<!-- init Foo::test() -->
|
||||
<Foo::test>
|
||||
</Foo::test:'foo::test'>
|
||||
<!-- init foo() -->
|
||||
<foo>
|
||||
</foo:'I should be observable'>
|
||||
Done
|
||||
</file '%sobserver_preload.php'>
|
Loading…
Add table
Add a link
Reference in a new issue