Skip to content

Commit 587110c

Browse files
authored
1 parent a6d7d52 commit 587110c

8 files changed

+106
-24
lines changed

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ PHP 8.4 UPGRADE NOTES
5656
. Previously, DOMXPath objects could be cloned, but resulted in an unusable
5757
object. This is no longer possible, and cloning a DOMXPath object now throws
5858
an error.
59+
. DOMDocument::$actualEncoding, DOMDocument::config, DOMEntity::$actualEncoding,
60+
DOMEntity::$encoding, DOMEntity::$version have been deprecated as part of the
61+
https://wiki.php.net/rfc/deprecations_php_8_4 RFC.
5962

6063
- GMP:
6164
. The GMP class is now final and cannot be extended anymore.

ext/dom/document.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ zend_result dom_document_encoding_read(dom_object *obj, zval *retval)
105105
return SUCCESS;
106106
}
107107

108+
zend_result dom_document_actual_encoding_read(dom_object *obj, zval *retval)
109+
{
110+
zend_error(E_DEPRECATED, "Property DOMDocument::$actualEncoding is deprecated");
111+
if (UNEXPECTED(EG(exception))) {
112+
return FAILURE;
113+
}
114+
115+
return dom_document_encoding_read(obj, retval);
116+
}
117+
108118
zend_result dom_document_encoding_write(dom_object *obj, zval *newval)
109119
{
110120
DOM_PROP_NODE(xmlDocPtr, docp, obj);
@@ -409,6 +419,11 @@ Since: DOM Level 3
409419
*/
410420
zend_result dom_document_config_read(dom_object *obj, zval *retval)
411421
{
422+
zend_error(E_DEPRECATED, "Property DOMDocument::$config is deprecated");
423+
if (UNEXPECTED(EG(exception))) {
424+
return FAILURE;
425+
}
426+
412427
ZVAL_NULL(retval);
413428
return SUCCESS;
414429
}

ext/dom/dom_properties.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ zend_result dom_document_implementation_read(dom_object *obj, zval *retval);
3737
zend_result dom_modern_document_implementation_read(dom_object *obj, zval *retval);
3838
zend_result dom_document_document_element_read(dom_object *obj, zval *retval);
3939
zend_result dom_document_encoding_read(dom_object *obj, zval *retval);
40+
zend_result dom_document_actual_encoding_read(dom_object *obj, zval *retval);
4041
zend_result dom_document_encoding_write(dom_object *obj, zval *newval);
4142
zend_result dom_document_standalone_read(dom_object *obj, zval *retval);
4243
zend_result dom_document_standalone_write(dom_object *obj, zval *newval);

ext/dom/entity.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ Since: DOM Level 3
104104
*/
105105
zend_result dom_entity_actual_encoding_read(dom_object *obj, zval *retval)
106106
{
107+
zend_error(E_DEPRECATED, "Property DOMEntity::$actualEncoding is deprecated");
108+
if (UNEXPECTED(EG(exception))) {
109+
return FAILURE;
110+
}
111+
107112
ZVAL_NULL(retval);
108113
return SUCCESS;
109114
}
@@ -117,6 +122,11 @@ Since: DOM Level 3
117122
*/
118123
zend_result dom_entity_encoding_read(dom_object *obj, zval *retval)
119124
{
125+
zend_error(E_DEPRECATED, "Property DOMEntity::$encoding is deprecated");
126+
if (UNEXPECTED(EG(exception))) {
127+
return FAILURE;
128+
}
129+
120130
ZVAL_NULL(retval);
121131
return SUCCESS;
122132
}
@@ -130,6 +140,11 @@ Since: DOM Level 3
130140
*/
131141
zend_result dom_entity_version_read(dom_object *obj, zval *retval)
132142
{
143+
zend_error(E_DEPRECATED, "Property DOMEntity::$version is deprecated");
144+
if (UNEXPECTED(EG(exception))) {
145+
return FAILURE;
146+
}
147+
133148
ZVAL_NULL(retval);
134149
return SUCCESS;
135150
}

ext/dom/php_dom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ PHP_MINIT_FUNCTION(dom)
894894
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "doctype", dom_document_doctype_read, NULL);
895895
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "implementation", dom_document_implementation_read, NULL);
896896
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "documentElement", dom_document_document_element_read, NULL);
897-
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "actualEncoding", dom_document_encoding_read, NULL);
897+
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "actualEncoding", dom_document_actual_encoding_read, NULL);
898898
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "encoding", dom_document_encoding_read, dom_document_encoding_write);
899899
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "xmlEncoding", dom_document_encoding_read, NULL);
900900
DOM_REGISTER_PROP_HANDLER(&dom_document_prop_handlers, "standalone", dom_document_standalone_read, dom_document_standalone_write);

ext/dom/tests/DOMDocument_config_basic.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ var_dump( $test );
1919

2020
echo "Done\n";
2121
?>
22-
--EXPECT--
22+
--EXPECTF--
2323
DOMDocument created
24+
25+
Deprecated: Property DOMDocument::$config is deprecated in %s on line %d
2426
Read config:
2527
NULL
2628
Done

ext/dom/tests/DOMEntity_fields.phpt

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,59 +42,101 @@ foreach ($entities as $entity) {
4242
echo "\n";
4343
}
4444
?>
45-
--EXPECT--
45+
--EXPECTF--
4646
Entity name: sampleExternalPublicWithNotationName1
4747
publicId: string(9) "public id"
4848
systemId: string(14) "external.stuff"
4949
notationName: string(5) "stuff"
50-
actualEncoding: NULL
51-
encoding: NULL
52-
version: NULL
50+
actualEncoding:
51+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
52+
NULL
53+
encoding:
54+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
55+
NULL
56+
version:
57+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
58+
NULL
5359

5460
Entity name: sampleExternalPublicWithNotationName2
5561
publicId: string(0) ""
5662
systemId: string(14) "external.stuff"
5763
notationName: string(5) "stuff"
58-
actualEncoding: NULL
59-
encoding: NULL
60-
version: NULL
64+
actualEncoding:
65+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
66+
NULL
67+
encoding:
68+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
69+
NULL
70+
version:
71+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
72+
NULL
6173

6274
Entity name: sampleExternalPublicWithoutNotationName1
6375
publicId: string(9) "public id"
6476
systemId: string(14) "external.stuff"
6577
notationName: string(0) ""
66-
actualEncoding: NULL
67-
encoding: NULL
68-
version: NULL
78+
actualEncoding:
79+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
80+
NULL
81+
encoding:
82+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
83+
NULL
84+
version:
85+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
86+
NULL
6987

7088
Entity name: sampleExternalPublicWithoutNotationName2
7189
publicId: string(0) ""
7290
systemId: string(14) "external.stuff"
7391
notationName: string(0) ""
74-
actualEncoding: NULL
75-
encoding: NULL
76-
version: NULL
92+
actualEncoding:
93+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
94+
NULL
95+
encoding:
96+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
97+
NULL
98+
version:
99+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
100+
NULL
77101

78102
Entity name: sampleExternalSystemWithNotationName
79103
publicId: NULL
80104
systemId: string(14) "external.stuff"
81105
notationName: string(5) "stuff"
82-
actualEncoding: NULL
83-
encoding: NULL
84-
version: NULL
106+
actualEncoding:
107+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
108+
NULL
109+
encoding:
110+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
111+
NULL
112+
version:
113+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
114+
NULL
85115

86116
Entity name: sampleExternalSystemWithoutNotationName
87117
publicId: NULL
88118
systemId: string(14) "external.stuff"
89119
notationName: string(0) ""
90-
actualEncoding: NULL
91-
encoding: NULL
92-
version: NULL
120+
actualEncoding:
121+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
122+
NULL
123+
encoding:
124+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
125+
NULL
126+
version:
127+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
128+
NULL
93129

94130
Entity name: sampleInternalEntity
95131
publicId: NULL
96132
systemId: NULL
97133
notationName: NULL
98-
actualEncoding: NULL
99-
encoding: NULL
100-
version: NULL
134+
actualEncoding:
135+
Deprecated: Property DOMEntity::$actualEncoding is deprecated in %s on line %d
136+
NULL
137+
encoding:
138+
Deprecated: Property DOMEntity::$encoding is deprecated in %s on line %d
139+
NULL
140+
version:
141+
Deprecated: Property DOMEntity::$version is deprecated in %s on line %d
142+
NULL

ext/dom/tests/domobject_debug_handler.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ var_dump($d);
1616
?>
1717
--EXPECTF--
1818
Deprecated: Creation of dynamic property DOMDocument::$dynamicProperty is deprecated in %s on line %d
19+
20+
Deprecated: Property DOMDocument::$actualEncoding is deprecated in %s on line %d
21+
22+
Deprecated: Property DOMDocument::$config is deprecated in %s on line %d
1923
object(DOMDocument)#1 (41) {
2024
["dynamicProperty"]=>
2125
object(stdClass)#2 (0) {

0 commit comments

Comments
 (0)