Skip to content

Commit f3ee902

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Backport deprecation warning ignores to unbreak CI
2 parents 6d50e58 + e2d9731 commit f3ee902

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Diff for: ext/libxml/php_libxml.h

+23-2
Original file line numberDiff line numberDiff line change
@@ -149,28 +149,49 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
149149
ZEND_TSRMLS_CACHE_EXTERN()
150150
#endif
151151

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+
152169
/* Other extension may override the global state options, these global options
153170
* are copied initially to ctxt->options. Set the options to a known good value.
154171
* See libxml2 globals.c and parserInternals.c.
155172
* The unique_name argument allows multiple sanitizes and restores within the
156173
* same function, even nested is necessary. */
157174
#define PHP_LIBXML_SANITIZE_GLOBALS(unique_name) \
175+
PHP_LIBXML_IGNORE_DEPRECATIONS_START \
158176
int xml_old_loadsubset_##unique_name = xmlLoadExtDtdDefaultValue; \
159177
xmlLoadExtDtdDefaultValue = 0; \
160178
int xml_old_validate_##unique_name = xmlDoValidityCheckingDefaultValue; \
161179
xmlDoValidityCheckingDefaultValue = 0; \
162180
int xml_old_pedantic_##unique_name = xmlPedanticParserDefault(0); \
163181
int xml_old_substitute_##unique_name = xmlSubstituteEntitiesDefault(0); \
164182
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
166185

167186
#define PHP_LIBXML_RESTORE_GLOBALS(unique_name) \
187+
PHP_LIBXML_IGNORE_DEPRECATIONS_START \
168188
xmlLoadExtDtdDefaultValue = xml_old_loadsubset_##unique_name; \
169189
xmlDoValidityCheckingDefaultValue = xml_old_validate_##unique_name; \
170190
(void) xmlPedanticParserDefault(xml_old_pedantic_##unique_name); \
171191
(void) xmlSubstituteEntitiesDefault(xml_old_substitute_##unique_name); \
172192
(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
174195

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

Diff for: ext/xsl/xsltprocessor.c

+2
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
350350
newdoc = xmlCopyDoc(doc, 1);
351351
xmlNodeSetBase((xmlNodePtr) newdoc, (xmlChar *)doc->URL);
352352
PHP_LIBXML_SANITIZE_GLOBALS(parse);
353+
PHP_LIBXML_IGNORE_DEPRECATIONS_START
353354
xmlSubstituteEntitiesDefault(1);
354355
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
356+
PHP_LIBXML_IGNORE_DEPRECATIONS_END
355357

356358
sheetp = xsltParseStylesheetDoc(newdoc);
357359
PHP_LIBXML_RESTORE_GLOBALS(parse);

0 commit comments

Comments
 (0)