1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Deprecate Soft-deprecated DOMDocument and DOMEntity properties (#15369)

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#formally_deprecate_soft-deprecated_domdocument_and_domentity_properties
This commit is contained in:
Máté Kocsis
2024-08-13 13:39:20 +02:00
committed by GitHub
parent a6d7d5234b
commit 587110c5bf
8 changed files with 106 additions and 24 deletions

View File

@@ -56,6 +56,9 @@ PHP 8.4 UPGRADE NOTES
. Previously, DOMXPath objects could be cloned, but resulted in an unusable
object. This is no longer possible, and cloning a DOMXPath object now throws
an error.
. DOMDocument::$actualEncoding, DOMDocument::config, DOMEntity::$actualEncoding,
DOMEntity::$encoding, DOMEntity::$version have been deprecated as part of the
https://wiki.php.net/rfc/deprecations_php_8_4 RFC.
- GMP:
. The GMP class is now final and cannot be extended anymore.

View File

@@ -105,6 +105,16 @@ zend_result dom_document_encoding_read(dom_object *obj, zval *retval)
return SUCCESS;
}
zend_result dom_document_actual_encoding_read(dom_object *obj, zval *retval)
{
zend_error(E_DEPRECATED, "Property DOMDocument::$actualEncoding is deprecated");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
return dom_document_encoding_read(obj, retval);
}
zend_result dom_document_encoding_write(dom_object *obj, zval *newval)
{
DOM_PROP_NODE(xmlDocPtr, docp, obj);
@@ -409,6 +419,11 @@ Since: DOM Level 3
*/
zend_result dom_document_config_read(dom_object *obj, zval *retval)
{
zend_error(E_DEPRECATED, "Property DOMDocument::$config is deprecated");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
ZVAL_NULL(retval);
return SUCCESS;
}

View File

@@ -37,6 +37,7 @@ zend_result dom_document_implementation_read(dom_object *obj, zval *retval);
zend_result dom_modern_document_implementation_read(dom_object *obj, zval *retval);
zend_result dom_document_document_element_read(dom_object *obj, zval *retval);
zend_result dom_document_encoding_read(dom_object *obj, zval *retval);
zend_result dom_document_actual_encoding_read(dom_object *obj, zval *retval);
zend_result dom_document_encoding_write(dom_object *obj, zval *newval);
zend_result dom_document_standalone_read(dom_object *obj, zval *retval);
zend_result dom_document_standalone_write(dom_object *obj, zval *newval);

View File

@@ -104,6 +104,11 @@ Since: DOM Level 3
*/
zend_result dom_entity_actual_encoding_read(dom_object *obj, zval *retval)
{
zend_error(E_DEPRECATED, "Property DOMEntity::$actualEncoding is deprecated");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
ZVAL_NULL(retval);
return SUCCESS;
}
@@ -117,6 +122,11 @@ Since: DOM Level 3
*/
zend_result dom_entity_encoding_read(dom_object *obj, zval *retval)
{
zend_error(E_DEPRECATED, "Property DOMEntity::$encoding is deprecated");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
ZVAL_NULL(retval);
return SUCCESS;
}
@@ -130,6 +140,11 @@ Since: DOM Level 3
*/
zend_result dom_entity_version_read(dom_object *obj, zval *retval)
{
zend_error(E_DEPRECATED, "Property DOMEntity::$version is deprecated");
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
ZVAL_NULL(retval);
return SUCCESS;
}

View File

@@ -894,7 +894,7 @@ PHP_MINIT_FUNCTION(dom)
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "doctype", dom_document_doctype_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "implementation", dom_document_implementation_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "documentElement", dom_document_document_element_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "actualEncoding", dom_document_encoding_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "actualEncoding", dom_document_actual_encoding_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "encoding", dom_document_encoding_read, dom_document_encoding_write);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "xmlEncoding", dom_document_encoding_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "standalone", dom_document_standalone_read, dom_document_standalone_write);

View File

@@ -19,8 +19,10 @@ var_dump( $test );
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
DOMDocument created
Deprecated: Property DOMDocument::$config is deprecated in %s on line %d
Read config:
NULL
Done

View File

@@ -42,59 +42,101 @@ foreach ($entities as $entity) {
echo "\n";
}
?>
--EXPECT--
--EXPECTF--
Entity name: sampleExternalPublicWithNotationName1
publicId: string(9) "public id"
systemId: string(14) "external.stuff"
notationName: string(5) "stuff"
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleExternalPublicWithNotationName2
publicId: string(0) ""
systemId: string(14) "external.stuff"
notationName: string(5) "stuff"
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleExternalPublicWithoutNotationName1
publicId: string(9) "public id"
systemId: string(14) "external.stuff"
notationName: string(0) ""
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleExternalPublicWithoutNotationName2
publicId: string(0) ""
systemId: string(14) "external.stuff"
notationName: string(0) ""
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleExternalSystemWithNotationName
publicId: NULL
systemId: string(14) "external.stuff"
notationName: string(5) "stuff"
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleExternalSystemWithoutNotationName
publicId: NULL
systemId: string(14) "external.stuff"
notationName: string(0) ""
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL
Entity name: sampleInternalEntity
publicId: NULL
systemId: NULL
notationName: NULL
actualEncoding: NULL
encoding: NULL
version: NULL
actualEncoding:
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
NULL
encoding:
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
NULL
version:
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
NULL

View File

@@ -16,6 +16,10 @@ var_dump($d);
?>
--EXPECTF--
Deprecated: Creation of dynamic property DOMDocument::$dynamicProperty is deprecated in %s on line %d
Deprecated: Property DOMDocument::$actualEncoding is deprecated in %s on line %d
Deprecated: Property DOMDocument::$config is deprecated in %s on line %d
object(DOMDocument)#1 (41) {
["dynamicProperty"]=>
object(stdClass)#2 (0) {