Skip to content

Error installing PHP when --with-pear is used #14834

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

Closed
rbgarga opened this issue Jul 5, 2024 · 11 comments
Closed

Error installing PHP when --with-pear is used #14834

rbgarga opened this issue Jul 5, 2024 · 11 comments

Comments

@rbgarga
Copy link

rbgarga commented Jul 5, 2024

Description

The following code:

./configure --with-pear
make
make install

Resulted in this output:

[PEAR] Archive_Tar    - already installed: 1.4.14
[PEAR] Console_Getopt - already installed: 1.4.3
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util       - already installed: 1.4.5
[PEAR] PEAR: Invalid tag order in <dependencies>, found <_content> expected one of "group"
[PEAR] PEAR: Parsing of package.xml from file "/tmp/pear/temp/pearilLpFg/package.xml" failed

Based on this comment from 3 days ago I'm not alone https://aur.archlinux.org/packages/php83-mysql#comment-980592

PHP Version

PHP 8.3.9

Operating System

Chimera linux

@rainerjung
Copy link

I can reproduce when building PHP 8.3.9 using libxml2 2.13.2 and libxslt 1.1.42. The problem does not occur with the same PHP sources and using libxml2 2.12.7 and libxslt 1.1.39. I will see, whether I can triage further.

@nielsdos
Copy link
Member

nielsdos commented Jul 5, 2024

I can reproduce this and is probably related to the libxml2 update.
Note though that PHP 8.3.9 is not compatible with libxml2 2.13, 8.3.10 will be. That said I can reproduce it on the latest development release of PHP as well.

@rbgarga
Copy link
Author

rbgarga commented Jul 5, 2024

For the record, libxml2 version on my system is 2.13.2

@nielsdos
Copy link
Member

nielsdos commented Jul 5, 2024

I tested it on libxml2 2.12 and it works, while 2.13 breaks. I'm starting to bisect libxml2 now.

@nielsdos
Copy link
Member

nielsdos commented Jul 5, 2024

Bisected to GNOME/libxml2@4f14fe9

@nielsdos
Copy link
Member

nielsdos commented Jul 5, 2024

I figured it out.
The following PHP code:

<?php
$parser = xml_parser_create();
xml_set_character_data_handler($parser, function($_, $data) {
    var_dump($data);
});
xml_parse($parser, file_get_contents('test.xml'), true);
?>

with the following XML document:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <element hint="hello&apos;world"/>
</root>

Now produces an extra ' output because the instate check is now always true because this functionality was heavily changed in the upstream library. This is a painful API break from libxml...

nielsdos added a commit to nielsdos/php-src that referenced this issue Jul 5, 2024
libxml2 2.13 makes changes to how the parsing state is set, update our
code accordingly. In particular, it started reporting entities within
attributes, while it should only report entities inside text nodes.
@nielsdos nielsdos linked a pull request Jul 5, 2024 that will close this issue
@nielsdos
Copy link
Member

nielsdos commented Jul 5, 2024

I opened a PR and the fix should be a part of the next 8.2 and 8.3 releases.

nielsdos added a commit that referenced this issue Jul 6, 2024
* PHP-8.2:
  Fix GH-14834: Error installing PHP when --with-pear is used
nielsdos added a commit that referenced this issue Jul 6, 2024
* PHP-8.3:
  Fix GH-14834: Error installing PHP when --with-pear is used
@rbgarga
Copy link
Author

rbgarga commented Jul 8, 2024

@nielsdos Thank you for the quick fix!

@will3216
Copy link

Sounds like a fix is on the way, but I was still seeing it when installing 8.2.x/8.3.x with asdf/homebrew today. Downgrading libxml2 solved this issue for me, but it was a bit tricky so I created a gist of the steps for anyone else who is running into it: https://gist.github.com/will3216/7d72f29bc5b2c6e5c3f3ef373ae0a365

@nielsdos
Copy link
Member

@will3216 This was fixed in 8.2.22/8.3.10 released on August 1st, so the fix is already released

@will3216
Copy link

I tried both of those versions with asdf and ran into this issue. Upon further inspection its pulling from "https://github.com/php/php-src/archive/php-${version}.tar.gz" as opposed to homebrew, its just using homebrew for the dependencies.

https://github.com/asdf-community/asdf-php/blob/master/bin/install

The downgrade suggested here solved it for me, so just wanted to share how to do it in case anyone else ended up here for the same reason

BjarneDMat pushed a commit to BjarneDMat/macports-ports that referenced this issue Mar 29, 2025
php/php-src#14834
Error installing PHP when --with-pear is used macports#14834

php/php-src@67259e4
Fix macportsGH-14834: Error installing PHP when --with-pear is used

Changes to be committed:
	modified:   lang/php/Portfile
	new file:   lang/php/files/ext-xml-tests-gh14834.phpt
	new file:   lang/php/files/patch-php74-ext-xml-compat.c.diff
	new file:   lang/php/files/patch-php80-ext-xml-compat.c.diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants