@@ -119,28 +119,49 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
119
119
ZEND_TSRMLS_CACHE_EXTERN ()
120
120
#endif
121
121
122
+ #if defined(__clang__ )
123
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
124
+ _Pragma("clang diagnostic push") \
125
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
126
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
127
+ _Pragma("clang diagnostic pop")
128
+ #elif defined(__GNUC__ )
129
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
130
+ _Pragma("GCC diagnostic push") \
131
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
132
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
133
+ _Pragma("GCC diagnostic pop")
134
+ #else
135
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START
136
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END
137
+ #endif
138
+
122
139
/* Other extension may override the global state options, these global options
123
140
* are copied initially to ctxt->options. Set the options to a known good value.
124
141
* See libxml2 globals.c and parserInternals.c.
125
142
* The unique_name argument allows multiple sanitizes and restores within the
126
143
* same function, even nested is necessary. */
127
144
#define PHP_LIBXML_SANITIZE_GLOBALS (unique_name ) \
145
+ PHP_LIBXML_IGNORE_DEPRECATIONS_START \
128
146
int xml_old_loadsubset_##unique_name = xmlLoadExtDtdDefaultValue; \
129
147
xmlLoadExtDtdDefaultValue = 0; \
130
148
int xml_old_validate_##unique_name = xmlDoValidityCheckingDefaultValue; \
131
149
xmlDoValidityCheckingDefaultValue = 0; \
132
150
int xml_old_pedantic_##unique_name = xmlPedanticParserDefault(0); \
133
151
int xml_old_substitute_##unique_name = xmlSubstituteEntitiesDefault(0); \
134
152
int xml_old_linenrs_##unique_name = xmlLineNumbersDefault(0); \
135
- int xml_old_blanks_##unique_name = xmlKeepBlanksDefault(1);
153
+ int xml_old_blanks_##unique_name = xmlKeepBlanksDefault(1); \
154
+ PHP_LIBXML_IGNORE_DEPRECATIONS_END
136
155
137
156
#define PHP_LIBXML_RESTORE_GLOBALS (unique_name ) \
157
+ PHP_LIBXML_IGNORE_DEPRECATIONS_START \
138
158
xmlLoadExtDtdDefaultValue = xml_old_loadsubset_##unique_name; \
139
159
xmlDoValidityCheckingDefaultValue = xml_old_validate_##unique_name; \
140
160
(void) xmlPedanticParserDefault(xml_old_pedantic_##unique_name); \
141
161
(void) xmlSubstituteEntitiesDefault(xml_old_substitute_##unique_name); \
142
162
(void) xmlLineNumbersDefault(xml_old_linenrs_##unique_name); \
143
- (void) xmlKeepBlanksDefault(xml_old_blanks_##unique_name);
163
+ (void) xmlKeepBlanksDefault(xml_old_blanks_##unique_name); \
164
+ PHP_LIBXML_IGNORE_DEPRECATIONS_END
144
165
145
166
/* Alternative for above, working directly on the context and not setting globals.
146
167
* Generally faster because no locking is involved, and this has the advantage that it sets the options to a known good value. */
0 commit comments