Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Properties deprecation in PHP 8.2 #501

Closed
stesie opened this issue Feb 4, 2023 · 4 comments
Closed

Dynamic Properties deprecation in PHP 8.2 #501

stesie opened this issue Feb 4, 2023 · 4 comments

Comments

@stesie
Copy link
Member

stesie commented Feb 4, 2023

With PHP 8.2 the test suite actually works, but reports half of the tests failing, since they have deprecation notices like this:

Deprecated: Creation of dynamic property V8Js::$foo is deprecated

... because of this: https://php.watch/versions/8.2/dynamic-properties-deprecated

It's likely best to tag all V8Js classes with #[AllowDynamicProperties] attribute to omit this notice.
Need to find out how to programatically set this attribute in C++ code 🙂

@chrisbckr
Copy link
Contributor

Maybe register_class_stdClass can help to figure out:
Zend/zend_builtin_functions_arginfo.h

static zend_class_entry *register_class_stdClass(void)
{
	zend_class_entry ce, *class_entry;

	INIT_CLASS_ENTRY(ce, "stdClass", class_stdClass_methods);
	class_entry = zend_register_internal_class_ex(&ce, NULL);
	class_entry->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;

	zend_string *attribute_name_AllowDynamicProperties_class_stdClass = zend_string_init_interned("AllowDynamicProperties", sizeof("AllowDynamicProperties") - 1, 1);
	zend_add_class_attribute(class_entry, attribute_name_AllowDynamicProperties_class_stdClass, 0);
	zend_string_release(attribute_name_AllowDynamicProperties_class_stdClass);

	return class_entry;
}

I will run some tests.

@chrisbckr
Copy link
Contributor

chrisbckr commented Feb 18, 2023

I've made the necessary changes for php8.2
#505
But some test are failling.

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test V8::executeString() : Use ArrayAccess with JavaScript native push method [tests/array_access_002.phpt]
Test V8::executeString() : Test PHP object construction controlled by JavaScript (protected ctor) [tests/js-construct-protected-ctor.phpt]
Test V8::executeString() : var_dump [tests/var_dump.phpt]
=====================================================================

@colinmollenhour
Copy link

Was this already fixed by #505 and #508? Basically, are all known PHP 8.2 issues fixed?

@stesie
Copy link
Member Author

stesie commented Apr 28, 2023

@colinmollenhour yes, all issues should be resolved. Just forgot to close this ticket.

@stesie stesie closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants