@@ -149,28 +149,49 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
149
149
ZEND_TSRMLS_CACHE_EXTERN ()
150
150
#endif
151
151
152
+ #if defined(__clang__ )
153
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
154
+ _Pragma("clang diagnostic push") \
155
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
156
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
157
+ _Pragma("clang diagnostic pop")
158
+ #elif defined(__GNUC__ )
159
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
160
+ _Pragma("GCC diagnostic push") \
161
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
162
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
163
+ _Pragma("GCC diagnostic pop")
164
+ #else
165
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START
166
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END
167
+ #endif
168
+
152
169
/* Other extension may override the global state options, these global options
153
170
* are copied initially to ctxt->options. Set the options to a known good value.
154
171
* See libxml2 globals.c and parserInternals.c.
155
172
* The unique_name argument allows multiple sanitizes and restores within the
156
173
* same function, even nested is necessary. */
157
174
#define PHP_LIBXML_SANITIZE_GLOBALS (unique_name ) \
175
+ PHP_LIBXML_IGNORE_DEPRECATIONS_START \
158
176
int xml_old_loadsubset_##unique_name = xmlLoadExtDtdDefaultValue; \
159
177
xmlLoadExtDtdDefaultValue = 0; \
160
178
int xml_old_validate_##unique_name = xmlDoValidityCheckingDefaultValue; \
161
179
xmlDoValidityCheckingDefaultValue = 0; \
162
180
int xml_old_pedantic_##unique_name = xmlPedanticParserDefault(0); \
163
181
int xml_old_substitute_##unique_name = xmlSubstituteEntitiesDefault(0); \
164
182
int xml_old_linenrs_##unique_name = xmlLineNumbersDefault(0); \
165
- int xml_old_blanks_##unique_name = xmlKeepBlanksDefault(1);
183
+ int xml_old_blanks_##unique_name = xmlKeepBlanksDefault(1); \
184
+ PHP_LIBXML_IGNORE_DEPRECATIONS_END
166
185
167
186
#define PHP_LIBXML_RESTORE_GLOBALS (unique_name ) \
187
+ PHP_LIBXML_IGNORE_DEPRECATIONS_START \
168
188
xmlLoadExtDtdDefaultValue = xml_old_loadsubset_##unique_name; \
169
189
xmlDoValidityCheckingDefaultValue = xml_old_validate_##unique_name; \
170
190
(void) xmlPedanticParserDefault(xml_old_pedantic_##unique_name); \
171
191
(void) xmlSubstituteEntitiesDefault(xml_old_substitute_##unique_name); \
172
192
(void) xmlLineNumbersDefault(xml_old_linenrs_##unique_name); \
173
- (void) xmlKeepBlanksDefault(xml_old_blanks_##unique_name);
193
+ (void) xmlKeepBlanksDefault(xml_old_blanks_##unique_name); \
194
+ PHP_LIBXML_IGNORE_DEPRECATIONS_END
174
195
175
196
/* Alternative for above, working directly on the context and not setting globals.
176
197
* 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