[php-src] PR #19832: ext: fix naming clash with libxml macro
| From: | ZhongRuoyu | Date: | Sun, 14 Sep 2025 13:23:15 +0000 |
| Subject: | [php-src] PR #19832: ext: fix naming clash with libxml macro | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33220@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19832
Author: ZhongRuoyu
In the macOS 26 SDK, xmlFree is defined as a macro for free. This causes issues where a same-named
variable is used. Renaming the variable to should_free resolves the issue.
See:
$ grep -B4 -A2 -n "#define xmlFree("
"Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.sdk/usr/include/libxml/globals.h"
261-#if defined(LIBXML_HAS_DEPRECATED_MEMORY_ALLOCATION_FUNCTIONS)
262-#define xmlMalloc(size) malloc(size)
263-#define xmlMallocAtomic(size) malloc(size)
264-#define xmlRealloc(ptr, size) realloc((ptr), (size))
265:#define xmlFree(ptr) free(ptr)
266-#define xmlMemStrdup(str) strdup(str)
267-#endif
Fixes:
In file included from
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/libxml/xmlIO.h:117,
from
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/libxml/parser.h:813,
from /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/php_dom.h:29,
from /private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:26:
/private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c: In function
'dom_compare_value':
/private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:208:17: error: called object
'free' is not a function or function pointer
208 | xmlFree(attr_value);
| ^~~~~~~
/private/tmp/php-20250914-13349-uqsk5o/php-8.4.12/ext/dom/attr.c:204:14: note: declared here
204 | bool free;
| ^~~~
make: *** [ext/dom/attr.lo] Error 1