@@ -280,16 +280,39 @@ static ZEND_FUNCTION(zend_get_current_func_name)
280
280
}
281
281
282
282
#if defined(HAVE_LIBXML ) && !defined(PHP_WIN32 )
283
+
284
+ /* This test relies on deprecated code to modify the global state of libxml.
285
+ * We cannot include the libxml header here as that would create a dependency on libxml from zend_test.
286
+ * On 8.2+ this uses ZEND_DIAGNOSTIC_IGNORED_START, but this doesn't exist on 8.1 */
287
+ #if defined(__clang__ )
288
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
289
+ _Pragma("clang diagnostic push") \
290
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
291
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
292
+ _Pragma("clang diagnostic pop")
293
+ #elif defined(__GNUC__ )
294
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
295
+ _Pragma("GCC diagnostic push") \
296
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
297
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
298
+ _Pragma("GCC diagnostic pop")
299
+ #else
300
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_START
301
+ # define PHP_LIBXML_IGNORE_DEPRECATIONS_END
302
+ #endif
303
+
283
304
static ZEND_FUNCTION (zend_test_override_libxml_global_state )
284
305
{
285
306
ZEND_PARSE_PARAMETERS_NONE ();
286
307
308
+ PHP_LIBXML_IGNORE_DEPRECATIONS_START
287
309
xmlLoadExtDtdDefaultValue = 1 ;
288
310
xmlDoValidityCheckingDefaultValue = 1 ;
289
311
(void ) xmlPedanticParserDefault (1 );
290
312
(void ) xmlSubstituteEntitiesDefault (1 );
291
313
(void ) xmlLineNumbersDefault (1 );
292
314
(void ) xmlKeepBlanksDefault (0 );
315
+ PHP_LIBXML_IGNORE_DEPRECATIONS_END
293
316
}
294
317
#endif
295
318
0 commit comments