Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libxml2 2.12.0 issue building from src #12702

Closed
nono303 opened this issue Nov 17, 2023 · 6 comments
Closed

libxml2 2.12.0 issue building from src #12702

nono303 opened this issue Nov 17, 2023 · 6 comments

Comments

@nono303
Copy link
Contributor

nono303 commented Nov 17, 2023

Description

Hi,
Testing libxml2 2.12.0 released yesterday, I had issue during PHP compilation (php 8.2.12 on Windows vs17 x64) seems libxml2 headers had been moved / cleaned ….
I had to patch ext/libxml & ext/dom to have it building

diff --git a/ext/dom/document.c b/ext/dom/document.c
index 64da4f051b..3c71f03ba3 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -26,6 +26,7 @@
 #ifdef LIBXML_SCHEMAS_ENABLED
 #include <libxml/relaxng.h>
 #include <libxml/xmlschemas.h>
+#include <libxml/xmlsave.h>
 #endif
 
 typedef struct _idsIterator idsIterator;
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index af1cc7d6ac..b484568bb1 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -35,6 +35,7 @@ extern zend_module_entry libxml_module_entry;
 
 #include "zend_smart_str.h"
 #include <libxml/tree.h>
+#include <libxml/parser.h>
 
 #define LIBXML_SAVE_NOEMPTYTAG 1<<2
 

I may let you qualify deeper this point.

PHP Version

PHP 8.2.12

Operating System

Win 10 x64

@nielsdos
Copy link
Member

Yeah you're right, and there are a whole bunch of deprecation warnings too.
Your patch is almost correct, the #include <libxml/xmlsave.h> line should be outside of the #ifdef LIBXML_SCHEMAS_ENABLED part though.

If you want you can make a PR.
If you don't want to do that I can apply the patch manually and add a Co-authored-by tag.
Whatever your prefer 🙂

@nono303
Copy link
Contributor Author

nono303 commented Nov 17, 2023

Many Thx @nielsdos!
U can apply the corrected patch manually ;)

Fyi on Windows build, we'll also have to deal with the deprecation of the win32 Makefile.msvc in profit of CMake (this is a good thing!) but which didn't offer yet the availability to build the libxml static for dll archive (preferred for PHP as libxml2 shared is not supported cf. this nonworking patch https://gist.github.com/auroraeosrose/3452993)

@nielsdos
Copy link
Member

Alright, I'll apply it manually, thanks!

RE Windows build:
I'm not sure actually why PHP wants a static build... I haven't looked into why that is yet, as it's been working fine since it was introduced in 2003. It might be possible to add an option to make it dynamically linkable.

nielsdos added a commit that referenced this issue Nov 17, 2023
* PHP-8.2:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
nielsdos added a commit that referenced this issue Nov 17, 2023
* PHP-8.3:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
@kloczek
Copy link

kloczek commented Nov 21, 2023

It would be good to backport this change to 8.2 branch as well.

@nielsdos
Copy link
Member

The change is already in the 8.2 branch and will be included in the next 8.2 release.

@kloczek
Copy link

kloczek commented Nov 21, 2023

Up sorry .. just checked and indeed it is backported however because in each code change is updated NEWS file it is not possible cleanly apply exact commit on top of last release 😞

ramsey pushed a commit that referenced this issue Nov 23, 2023
Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants