Skip to content

Commit e2d9731

Browse files
committed
Backport deprecation warning ignores to unbreak CI
In master I use ZEND_DIAGNOSTIC_IGNORED_START, but that doesn't exist on 8.2 or 8.3 (8.3 has a similar macro though). So to unbreak CI I just made a variation of this directly in the php_libxml.h header. See 683e787#commitcomment-134301083 Closes GH-12887.
1 parent 0d1bf58 commit e2d9731

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

ext/libxml/php_libxml.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,49 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
119119
ZEND_TSRMLS_CACHE_EXTERN()
120120
#endif
121121

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+
122139
/* Other extension may override the global state options, these global options
123140
* are copied initially to ctxt->options. Set the options to a known good value.
124141
* See libxml2 globals.c and parserInternals.c.
125142
* The unique_name argument allows multiple sanitizes and restores within the
126143
* same function, even nested is necessary. */
127144
#define PHP_LIBXML_SANITIZE_GLOBALS(unique_name) \
145+
PHP_LIBXML_IGNORE_DEPRECATIONS_START \
128146
int xml_old_loadsubset_##unique_name = xmlLoadExtDtdDefaultValue; \
129147
xmlLoadExtDtdDefaultValue = 0; \
130148
int xml_old_validate_##unique_name = xmlDoValidityCheckingDefaultValue; \
131149
xmlDoValidityCheckingDefaultValue = 0; \
132150
int xml_old_pedantic_##unique_name = xmlPedanticParserDefault(0); \
133151
int xml_old_substitute_##unique_name = xmlSubstituteEntitiesDefault(0); \
134152
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
136155

137156
#define PHP_LIBXML_RESTORE_GLOBALS(unique_name) \
157+
PHP_LIBXML_IGNORE_DEPRECATIONS_START \
138158
xmlLoadExtDtdDefaultValue = xml_old_loadsubset_##unique_name; \
139159
xmlDoValidityCheckingDefaultValue = xml_old_validate_##unique_name; \
140160
(void) xmlPedanticParserDefault(xml_old_pedantic_##unique_name); \
141161
(void) xmlSubstituteEntitiesDefault(xml_old_substitute_##unique_name); \
142162
(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
144165

145166
/* Alternative for above, working directly on the context and not setting globals.
146167
* Generally faster because no locking is involved, and this has the advantage that it sets the options to a known good value. */

ext/xsl/xsltprocessor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
338338
newdoc = xmlCopyDoc(doc, 1);
339339
xmlNodeSetBase((xmlNodePtr) newdoc, (xmlChar *)doc->URL);
340340
PHP_LIBXML_SANITIZE_GLOBALS(parse);
341+
PHP_LIBXML_IGNORE_DEPRECATIONS_START
341342
xmlSubstituteEntitiesDefault(1);
342343
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
344+
PHP_LIBXML_IGNORE_DEPRECATIONS_END
343345

344346
sheetp = xsltParseStylesheetDoc(newdoc);
345347
PHP_LIBXML_RESTORE_GLOBALS(parse);

0 commit comments

Comments
 (0)