Skip to content

Commit ce9acaa

Browse files
committed
ext/libxml: Fix build failure with libxml2 2.15.
Fix GH-22752 libxml2 2.15 removed the built-in HTTP client, the FTP module, the functions in xmlunicode.h, the shell and several other legacy symbols. The Windows export list php_libxml2.def still referenced them, so the statically linked build failed with hundreds of unresolved external symbols. Move the removed symbols into a separate php_libxml2_legacy.def and add it only when building against libxml2 < 2.15, keeping the exports intact for 2.11 through 2.14.
1 parent bdcf9ce commit ce9acaa

3 files changed

Lines changed: 242 additions & 235 deletions

File tree

ext/libxml/config.w32

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ if (PHP_LIBXML == "yes") {
1212
if (GREP_HEADER("libxml/xmlversion.h", "#define\\s+LIBXML_VERSION\\s+(\\d+)", PHP_PHP_BUILD + "\\include\\libxml2") &&
1313
+RegExp.$1 >= 20904) {
1414

15+
var libxml_ver = +RegExp.$1; /* capture now; RegExp.$1 gets clobbered below */
16+
1517
EXTENSION("libxml", "libxml.c mime_sniff.c", false /* never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1618
AC_DEFINE("HAVE_LIBXML", 1, "Define to 1 if the PHP extension 'libxml' is available.");
1719
ADD_FLAG("CFLAGS_LIBXML", "/D LIBXML_STATIC /D LIBXML_STATIC_FOR_DLL /D HAVE_WIN32_THREADS ");
1820
if (!PHP_LIBXML_SHARED) {
1921
ADD_DEF_FILE("ext\\libxml\\php_libxml2.def");
22+
if (libxml_ver < 21500) {
23+
/* HTTP/FTP modules, xmlunicode.h and other legacy symbols were removed in libxml2 2.15 */
24+
ADD_DEF_FILE("ext\\libxml\\php_libxml2_legacy.def");
25+
}
2026
}
2127
PHP_INSTALL_HEADERS("ext/libxml", "php_libxml.h");
2228
} else {

ext/libxml/php_libxml2.def

Lines changed: 0 additions & 235 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
EXPORTS
2-
__htmlDefaultSAXHandler
32
__oldXMLWDcompatibility
43
__xmlBufferAllocScheme
54
__xmlDefaultBufferSize
6-
__xmlDefaultSAXHandler
7-
__xmlDefaultSAXLocator
85
__xmlDeregisterNodeDefaultValue
96
__xmlDoValidityCheckingDefaultValue
107
xmlFree DATA
118
__xmlGenericError
129
__xmlGenericErrorContext
1310
__xmlGetWarningsDefaultValue
1411
__xmlIndentTreeOutput
15-
xmlIsBaseCharGroup DATA
16-
xmlIsCharGroup DATA
17-
xmlIsCombiningGroup DATA
18-
xmlIsDigitGroup DATA
19-
xmlIsExtenderGroup DATA
20-
xmlIsIdeographicGroup DATA
2112
xmlIsPubidChar_tab DATA
2213
__xmlKeepBlanksDefaultValue
2314
xmlLastError DATA
@@ -44,7 +35,6 @@ __xmlTreeIndentString
4435
xmlXPathNAN DATA
4536
xmlXPathNINF DATA
4637
xmlXPathPINF DATA
47-
UTF8ToHtml
4838
UTF8Toisolat1
4939
attribute
5040
attributeDecl
@@ -443,11 +433,6 @@ xmlIOFTPClose
443433
xmlIOFTPMatch
444434
xmlIOFTPOpen
445435
xmlIOFTPRead
446-
xmlIOHTTPClose
447-
xmlIOHTTPMatch
448-
xmlIOHTTPOpen
449-
xmlIOHTTPOpenW
450-
xmlIOHTTPRead
451436
xmlIOParseDTD
452437
xmlInitCharEncodingHandlers
453438
xmlInitGlobals
@@ -533,45 +518,6 @@ xmlMutexUnlock
533518
xmlNamespaceParseNCName
534519
xmlNamespaceParseNSDef
535520
xmlNamespaceParseQName
536-
xmlNanoFTPCheckResponse
537-
xmlNanoFTPCleanup
538-
xmlNanoFTPClose
539-
xmlNanoFTPCloseConnection
540-
xmlNanoFTPConnect
541-
xmlNanoFTPConnectTo
542-
xmlNanoFTPCwd
543-
xmlNanoFTPDele
544-
xmlNanoFTPFreeCtxt
545-
xmlNanoFTPGet
546-
xmlNanoFTPGetConnection
547-
xmlNanoFTPGetResponse
548-
xmlNanoFTPGetSocket
549-
xmlNanoFTPInit
550-
xmlNanoFTPList
551-
xmlNanoFTPNewCtxt
552-
xmlNanoFTPOpen
553-
xmlNanoFTPProxy
554-
xmlNanoFTPQuit
555-
xmlNanoFTPRead
556-
xmlNanoFTPScanProxy
557-
xmlNanoFTPUpdateURL
558-
xmlNanoHTTPAuthHeader
559-
xmlNanoHTTPCleanup
560-
xmlNanoHTTPClose
561-
xmlNanoHTTPContentLength
562-
xmlNanoHTTPEncoding
563-
xmlNanoHTTPFetch
564-
xmlNanoHTTPInit
565-
xmlNanoHTTPMethod
566-
xmlNanoHTTPMethodRedir
567-
xmlNanoHTTPMimeType
568-
xmlNanoHTTPOpen
569-
xmlNanoHTTPOpenRedir
570-
xmlNanoHTTPRead
571-
xmlNanoHTTPRedir
572-
xmlNanoHTTPReturnCode
573-
xmlNanoHTTPSave
574-
xmlNanoHTTPScanProxy
575521
xmlNewAutomata
576522
xmlNewCDataBlock
577523
xmlNewCatalog
@@ -783,7 +729,6 @@ xmlRegexpPrint
783729
xmlRegisterCharEncodingHandler
784730
xmlRegisterDefaultInputCallbacks
785731
xmlRegisterDefaultOutputCallbacks
786-
xmlRegisterHTTPPostCallbacks
787732
xmlRegisterInputCallbacks
788733
xmlRegisterNodeDefault
789734
xmlRegisterOutputCallbacks
@@ -929,20 +874,6 @@ xmlSetProp
929874
xmlSetStructuredErrorFunc
930875
xmlSetTreeDoc
931876
xmlSetupParserForBuffer
932-
xmlShell
933-
xmlShellBase
934-
xmlShellCat
935-
xmlShellDir
936-
xmlShellDu
937-
xmlShellList
938-
xmlShellLoad
939-
xmlShellPrintNode
940-
xmlShellPrintXPathError
941-
xmlShellPrintXPathResult
942-
xmlShellPwd
943-
xmlShellSave
944-
xmlShellValidate
945-
xmlShellWrite
946877
xmlSkipBlankChars
947878
xmlSnprintfElementContent
948879
xmlSplitQName
@@ -1135,172 +1066,6 @@ xmlThrDefSetGenericErrorFunc
11351066
xmlThrDefSetStructuredErrorFunc
11361067
xmlThrDefSubstituteEntitiesDefaultValue
11371068
xmlThrDefTreeIndentString
1138-
xmlUCSIsAegeanNumbers
1139-
xmlUCSIsAlphabeticPresentationForms
1140-
xmlUCSIsArabic
1141-
xmlUCSIsArabicPresentationFormsA
1142-
xmlUCSIsArabicPresentationFormsB
1143-
xmlUCSIsArmenian
1144-
xmlUCSIsArrows
1145-
xmlUCSIsBasicLatin
1146-
xmlUCSIsBengali
1147-
xmlUCSIsBlock
1148-
xmlUCSIsBlockElements
1149-
xmlUCSIsBopomofo
1150-
xmlUCSIsBopomofoExtended
1151-
xmlUCSIsBoxDrawing
1152-
xmlUCSIsBraillePatterns
1153-
xmlUCSIsBuhid
1154-
xmlUCSIsByzantineMusicalSymbols
1155-
xmlUCSIsCJKCompatibility
1156-
xmlUCSIsCJKCompatibilityForms
1157-
xmlUCSIsCJKCompatibilityIdeographs
1158-
xmlUCSIsCJKCompatibilityIdeographsSupplement
1159-
xmlUCSIsCJKRadicalsSupplement
1160-
xmlUCSIsCJKSymbolsandPunctuation
1161-
xmlUCSIsCJKUnifiedIdeographs
1162-
xmlUCSIsCJKUnifiedIdeographsExtensionA
1163-
xmlUCSIsCJKUnifiedIdeographsExtensionB
1164-
xmlUCSIsCat
1165-
xmlUCSIsCatC
1166-
xmlUCSIsCatCc
1167-
xmlUCSIsCatCf
1168-
xmlUCSIsCatCo
1169-
xmlUCSIsCatCs
1170-
xmlUCSIsCatL
1171-
xmlUCSIsCatLl
1172-
xmlUCSIsCatLm
1173-
xmlUCSIsCatLo
1174-
xmlUCSIsCatLt
1175-
xmlUCSIsCatLu
1176-
xmlUCSIsCatM
1177-
xmlUCSIsCatMc
1178-
xmlUCSIsCatMe
1179-
xmlUCSIsCatMn
1180-
xmlUCSIsCatN
1181-
xmlUCSIsCatNd
1182-
xmlUCSIsCatNl
1183-
xmlUCSIsCatNo
1184-
xmlUCSIsCatP
1185-
xmlUCSIsCatPc
1186-
xmlUCSIsCatPd
1187-
xmlUCSIsCatPe
1188-
xmlUCSIsCatPf
1189-
xmlUCSIsCatPi
1190-
xmlUCSIsCatPo
1191-
xmlUCSIsCatPs
1192-
xmlUCSIsCatS
1193-
xmlUCSIsCatSc
1194-
xmlUCSIsCatSk
1195-
xmlUCSIsCatSm
1196-
xmlUCSIsCatSo
1197-
xmlUCSIsCatZ
1198-
xmlUCSIsCatZl
1199-
xmlUCSIsCatZp
1200-
xmlUCSIsCatZs
1201-
xmlUCSIsCherokee
1202-
xmlUCSIsCombiningDiacriticalMarks
1203-
xmlUCSIsCombiningDiacriticalMarksforSymbols
1204-
xmlUCSIsCombiningHalfMarks
1205-
xmlUCSIsCombiningMarksforSymbols
1206-
xmlUCSIsControlPictures
1207-
xmlUCSIsCurrencySymbols
1208-
xmlUCSIsCypriotSyllabary
1209-
xmlUCSIsCyrillic
1210-
xmlUCSIsCyrillicSupplement
1211-
xmlUCSIsDeseret
1212-
xmlUCSIsDevanagari
1213-
xmlUCSIsDingbats
1214-
xmlUCSIsEnclosedAlphanumerics
1215-
xmlUCSIsEnclosedCJKLettersandMonths
1216-
xmlUCSIsEthiopic
1217-
xmlUCSIsGeneralPunctuation
1218-
xmlUCSIsGeometricShapes
1219-
xmlUCSIsGeorgian
1220-
xmlUCSIsGothic
1221-
xmlUCSIsGreek
1222-
xmlUCSIsGreekExtended
1223-
xmlUCSIsGreekandCoptic
1224-
xmlUCSIsGujarati
1225-
xmlUCSIsGurmukhi
1226-
xmlUCSIsHalfwidthandFullwidthForms
1227-
xmlUCSIsHangulCompatibilityJamo
1228-
xmlUCSIsHangulJamo
1229-
xmlUCSIsHangulSyllables
1230-
xmlUCSIsHanunoo
1231-
xmlUCSIsHebrew
1232-
xmlUCSIsHighPrivateUseSurrogates
1233-
xmlUCSIsHighSurrogates
1234-
xmlUCSIsHiragana
1235-
xmlUCSIsIPAExtensions
1236-
xmlUCSIsIdeographicDescriptionCharacters
1237-
xmlUCSIsKanbun
1238-
xmlUCSIsKangxiRadicals
1239-
xmlUCSIsKannada
1240-
xmlUCSIsKatakana
1241-
xmlUCSIsKatakanaPhoneticExtensions
1242-
xmlUCSIsKhmer
1243-
xmlUCSIsKhmerSymbols
1244-
xmlUCSIsLao
1245-
xmlUCSIsLatin1Supplement
1246-
xmlUCSIsLatinExtendedA
1247-
xmlUCSIsLatinExtendedAdditional
1248-
xmlUCSIsLatinExtendedB
1249-
xmlUCSIsLetterlikeSymbols
1250-
xmlUCSIsLimbu
1251-
xmlUCSIsLinearBIdeograms
1252-
xmlUCSIsLinearBSyllabary
1253-
xmlUCSIsLowSurrogates
1254-
xmlUCSIsMalayalam
1255-
xmlUCSIsMathematicalAlphanumericSymbols
1256-
xmlUCSIsMathematicalOperators
1257-
xmlUCSIsMiscellaneousMathematicalSymbolsA
1258-
xmlUCSIsMiscellaneousMathematicalSymbolsB
1259-
xmlUCSIsMiscellaneousSymbols
1260-
xmlUCSIsMiscellaneousSymbolsandArrows
1261-
xmlUCSIsMiscellaneousTechnical
1262-
xmlUCSIsMongolian
1263-
xmlUCSIsMusicalSymbols
1264-
xmlUCSIsMyanmar
1265-
xmlUCSIsNumberForms
1266-
xmlUCSIsOgham
1267-
xmlUCSIsOldItalic
1268-
xmlUCSIsOpticalCharacterRecognition
1269-
xmlUCSIsOriya
1270-
xmlUCSIsOsmanya
1271-
xmlUCSIsPhoneticExtensions
1272-
xmlUCSIsPrivateUse
1273-
xmlUCSIsPrivateUseArea
1274-
xmlUCSIsRunic
1275-
xmlUCSIsShavian
1276-
xmlUCSIsSinhala
1277-
xmlUCSIsSmallFormVariants
1278-
xmlUCSIsSpacingModifierLetters
1279-
xmlUCSIsSpecials
1280-
xmlUCSIsSuperscriptsandSubscripts
1281-
xmlUCSIsSupplementalArrowsA
1282-
xmlUCSIsSupplementalArrowsB
1283-
xmlUCSIsSupplementalMathematicalOperators
1284-
xmlUCSIsSupplementaryPrivateUseAreaA
1285-
xmlUCSIsSupplementaryPrivateUseAreaB
1286-
xmlUCSIsSyriac
1287-
xmlUCSIsTagalog
1288-
xmlUCSIsTagbanwa
1289-
xmlUCSIsTags
1290-
xmlUCSIsTaiLe
1291-
xmlUCSIsTaiXuanJingSymbols
1292-
xmlUCSIsTamil
1293-
xmlUCSIsTelugu
1294-
xmlUCSIsThaana
1295-
xmlUCSIsThai
1296-
xmlUCSIsTibetan
1297-
xmlUCSIsUgaritic
1298-
xmlUCSIsUnifiedCanadianAboriginalSyllabics
1299-
xmlUCSIsVariationSelectors
1300-
xmlUCSIsVariationSelectorsSupplement
1301-
xmlUCSIsYiRadicals
1302-
xmlUCSIsYiSyllables
1303-
xmlUCSIsYijingHexagramSymbols
13041069
xmlURIEscape
13051070
xmlURIEscapeStr
13061071
xmlURIUnescapeString

0 commit comments

Comments
 (0)