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

Multiple test failures when building with --with-expat #13517

Closed
hannob opened this issue Feb 26, 2024 · 4 comments
Closed

Multiple test failures when building with --with-expat #13517

hannob opened this issue Feb 26, 2024 · 4 comments

Comments

@hannob
Copy link

hannob commented Feb 26, 2024

Description

Compiling latest php with expat support (./configure --with-expat; make; make test) leads to multiple test failures in xml-related tests.

I'll attach the test output.

I'm unsure about the support status of expat in php. This doc https://www.php.net/manual/en/xml.requirements.php implies that with that option, it would use expat as its xml backend. But when building, it links against both libxml2 and expat, and I'm unsure what the implications are. Those docs also link to a very old expat webpage, and the notes about building expat are probably obsolete. I think it would be good to update and clarify those docs.

This is I believe the relevant part from the test log:

FAILED TEST SUMMARY
---------------------------------------------------------------------
ReflectionExtension::getDependencies() [ext/reflection/tests/016.phpt]
Test setlocale() function : usage variations - setting system locale = 0 [ext/standard/tests/strings/setlocale_variation3.phpt]
Test setlocale() function : usage variations - setting system locale as null [ext/standard/tests/strings/setlocale_variation4.phpt]
Test setlocale() function : usage variations - Setting system locale as empty string [ext/standard/tests/strings/setlocale_variation5.phpt]
Bug #26614 (CDATA sections skipped on line count) [ext/xml/tests/bug26614_libxml_gte2_11.phpt]
Bug #46699: (xml_parse crash when parser is namespace aware) [ext/xml/tests/bug46699.phpt]
Bug #81351 (xml_parse may fail, but has no error code) [ext/xml/tests/bug81351.phpt]
xml_error_string() - Basic test on 5 error codes [ext/xml/tests/xml_error_string_basic.phpt]
Test xml_set_start_namespace_decl_handler function: basic [ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt]

(The setlocale failures seem unrelated to expat/xml, they also appear when building with default options)
php_test_results_20240226_1616.txt

PHP Version

PHP 8.3.3

Operating System

No response

@nielsdos
Copy link
Member

Thanks for the report. The failures come from both the evolution of the expat library, and because some tests assume libxml2 behaviour with respect to error handling. There are small differences in how errors are handled and reported which cause visible differences in the tests. The differences are not bugs. The solution I went with was to split the tests.

I'm unsure about the support status of expat in php.

Still works, just not tested on a regular basis.

But when building, it links against both libxml2 and expat, and I'm unsure what the implications are.

The XML extension links against expat, but since you still have other XML extension enabled (e.g. the DOM extension), they link against libxml2. This has no negative impact.

Those docs also link to a very old expat webpage, and the notes about building expat are probably obsolete. I think it would be good to update and clarify those docs.

I've made a PR to update the expat library URLs too: php/doc-base#117

(The setlocale failures seem unrelated to expat/xml, they also appear when building with default options)

Seems harmless, it's configuration related.

nielsdos added a commit to nielsdos/php-src that referenced this issue Feb 26, 2024
The reflection failure is because the XML extension is used to check the
module dependency information, but that extension can be configured to
not depend on ext/libxml, resulting in a different output. The solution
is to check another extension instead.

The test failures in ext/xml/tests are because of different behaviour
between libxml2 and Expat error handling. These are expected differences
and the solution is to split the tests.
@hartwork
Copy link

@nielsdos is there a chance that the CI could be made to also cover compilation and test execution with --with-expat so that it's impossible to break without noticing in the future?

@nielsdos
Copy link
Member

We could add it to the nightly workflow.
Either as a small seperate task or by compiling the xml extension shared twice and loading each of them once to test. Probably the first option is the most easy one. Cc @iluuu1994 what do you think?

@iluuu1994
Copy link
Member

@nielsdos That makes sense to me.

nielsdos added a commit that referenced this issue Feb 27, 2024
* PHP-8.2:
  Fix GH-13517: Multiple test failures when building with --with-expat
nielsdos added a commit that referenced this issue Feb 27, 2024
* PHP-8.3:
  Fix GH-13517: Multiple test failures when building with --with-expat
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.

5 participants