mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-08 13:48:40 +00:00
* Added AllowDynamicPropertis on V8Js, V8Object and V8Function
* Added #[AllowDynamicProperties] on test classes that uses Dynamic Properties
This commit is contained in:
parent
7c40690ec0
commit
83431fbd52
@ -5,6 +5,7 @@ Test V8::executeString() : has_property after dispose
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Foo {
|
class Foo {
|
||||||
function callMe($x) {
|
function callMe($x) {
|
||||||
var_dump(property_exists($x, 'bla'));
|
var_dump(property_exists($x, 'bla'));
|
||||||
|
@ -5,6 +5,7 @@ Test V8::executeString() : Issue #250 (early free of array)
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class TestObject {
|
class TestObject {
|
||||||
|
|
||||||
private $data = [];
|
private $data = [];
|
||||||
@ -55,9 +56,9 @@ try {
|
|||||||
?>
|
?>
|
||||||
===EOF===
|
===EOF===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught Error: Attempt to modify property "b" on null in %s%eissue_250_001.php:9
|
Fatal error: Uncaught Error: Attempt to modify property "b" on null in %s%eissue_250_001.php:10
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: TestObject->setTitle('ouch')
|
#0 [internal function]: TestObject->setTitle('ouch')
|
||||||
#1 %s%eissue_250_001.php(44): V8Js->executeString(' var v1 = se...')
|
#1 %s%eissue_250_001.php(45): V8Js->executeString(' var v1 = se...')
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s%eissue_250_001.php on line 9
|
thrown in %s%eissue_250_001.php on line 10
|
||||||
|
@ -5,6 +5,7 @@ Test V8::executeString() : Property visibility - has property
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Foo {
|
class Foo {
|
||||||
private $privBar = "privBar";
|
private $privBar = "privBar";
|
||||||
protected $protBar = "protBar";
|
protected $protBar = "protBar";
|
||||||
|
@ -5,6 +5,7 @@ Test V8::executeString() : Property visibility - set
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Foo {
|
class Foo {
|
||||||
private $privBar = "privBar";
|
private $privBar = "privBar";
|
||||||
protected $protBar = "protBar";
|
protected $protBar = "protBar";
|
||||||
|
@ -5,6 +5,7 @@ Test V8::executeString() : Use after dispose
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Foo {
|
class Foo {
|
||||||
function callMe($x) {
|
function callMe($x) {
|
||||||
var_dump($x);
|
var_dump($x);
|
||||||
|
@ -34,6 +34,7 @@ extern "C" {
|
|||||||
#include "zend_closures.h"
|
#include "zend_closures.h"
|
||||||
#include "ext/spl/spl_exceptions.h"
|
#include "ext/spl/spl_exceptions.h"
|
||||||
#include "zend_exceptions.h"
|
#include "zend_exceptions.h"
|
||||||
|
#include "zend_attributes.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PHP_V8JS_SCRIPT_RES_NAME "V8Js script"
|
#define PHP_V8JS_SCRIPT_RES_NAME "V8Js script"
|
||||||
@ -1059,6 +1060,14 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */
|
|||||||
php_ce_v8js = zend_register_internal_class(&ce);
|
php_ce_v8js = zend_register_internal_class(&ce);
|
||||||
php_ce_v8js->create_object = v8js_new;
|
php_ce_v8js->create_object = v8js_new;
|
||||||
|
|
||||||
|
#if PHP_VERSION_ID >= 80200
|
||||||
|
php_ce_v8js->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
|
||||||
|
|
||||||
|
zend_string *attribute_name_AllowDynamicProperties_class_V8Js = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
|
||||||
|
zend_add_class_attribute(php_ce_v8js, attribute_name_AllowDynamicProperties_class_V8Js, 0);
|
||||||
|
zend_string_release(attribute_name_AllowDynamicProperties_class_V8Js);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* V8Js handlers */
|
/* V8Js handlers */
|
||||||
memcpy(&v8js_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
memcpy(&v8js_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||||
v8js_object_handlers.clone_obj = NULL;
|
v8js_object_handlers.clone_obj = NULL;
|
||||||
|
@ -29,6 +29,7 @@ extern "C"
|
|||||||
#include "zend_closures.h"
|
#include "zend_closures.h"
|
||||||
#include "ext/spl/spl_exceptions.h"
|
#include "ext/spl/spl_exceptions.h"
|
||||||
#include "zend_exceptions.h"
|
#include "zend_exceptions.h"
|
||||||
|
#include "zend_attributes.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* {{{ Class Entries */
|
/* {{{ Class Entries */
|
||||||
@ -899,12 +900,28 @@ PHP_MINIT_FUNCTION(v8js_v8object_class) /* {{{ */
|
|||||||
php_ce_v8object->ce_flags |= ZEND_ACC_FINAL;
|
php_ce_v8object->ce_flags |= ZEND_ACC_FINAL;
|
||||||
php_ce_v8object->create_object = v8js_v8object_new;
|
php_ce_v8object->create_object = v8js_v8object_new;
|
||||||
|
|
||||||
|
#if PHP_VERSION_ID >= 80200
|
||||||
|
php_ce_v8object->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
|
||||||
|
|
||||||
|
zend_string *attribute_name_AllowDynamicProperties_class_v8object = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
|
||||||
|
zend_add_class_attribute(php_ce_v8object, attribute_name_AllowDynamicProperties_class_v8object, 0);
|
||||||
|
zend_string_release(attribute_name_AllowDynamicProperties_class_v8object);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* V8Function Class */
|
/* V8Function Class */
|
||||||
INIT_CLASS_ENTRY(ce, "V8Function", v8js_v8function_methods);
|
INIT_CLASS_ENTRY(ce, "V8Function", v8js_v8function_methods);
|
||||||
php_ce_v8function = zend_register_internal_class(&ce);
|
php_ce_v8function = zend_register_internal_class(&ce);
|
||||||
php_ce_v8function->ce_flags |= ZEND_ACC_FINAL;
|
php_ce_v8function->ce_flags |= ZEND_ACC_FINAL;
|
||||||
php_ce_v8function->create_object = v8js_v8object_new;
|
php_ce_v8function->create_object = v8js_v8object_new;
|
||||||
|
|
||||||
|
#if PHP_VERSION_ID >= 80200
|
||||||
|
php_ce_v8function->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
|
||||||
|
|
||||||
|
zend_string *attribute_name_AllowDynamicProperties_class_v8function = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
|
||||||
|
zend_add_class_attribute(php_ce_v8function, attribute_name_AllowDynamicProperties_class_v8function, 0);
|
||||||
|
zend_string_release(attribute_name_AllowDynamicProperties_class_v8function);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* V8Generator Class */
|
/* V8Generator Class */
|
||||||
INIT_CLASS_ENTRY(ce, "V8Generator", v8js_v8generator_methods);
|
INIT_CLASS_ENTRY(ce, "V8Generator", v8js_v8generator_methods);
|
||||||
php_ce_v8generator = zend_register_internal_class(&ce);
|
php_ce_v8generator = zend_register_internal_class(&ce);
|
||||||
|
Loading…
Reference in New Issue
Block a user