|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31829 Schema Validation Infinite Loop
Submitted: 2005-02-03 16:02 UTC Modified: 2005-02-21 19:56 UTC
From: lphuberdeau at phpquebec dot org Assigned:
Status: No Feedback Package: *XML functions
PHP Version: 5.0.3 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: lphuberdeau at phpquebec dot org
New email:
PHP Version: OS:


 [2005-02-03 16:02 UTC] lphuberdeau at phpquebec dot org
When validating an XML document using a schema with references to other schemas, the validation falls in a loop until the script dies due to insufficient memory. Seems like there is no check to verify if the file has already been included. This bug might actually be located in libxml2.

I was able to avoid the problem by only placing includes in the primary XSD.

Reproduce code:
Validate a DOM tree with a schema (schema1.xsd) with the following structure:

include schema2.xsd
include schema3.xsd

include schema3.xsd

include schema2.xsd

Expected result:
The file to validate, ignoring any already included files, or at least throw an exception.

Actual result:
Using PHP-CLI, the system goes in an infinite loop and uses all available system memory. I would suspect the script to crash in a web environment with a memory limit.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-03 19:12 UTC]
Most certainly a libxml2 bug. PHP has nothing to do with the actual parsing and validation.

Can you check with xmllint, if that has the same problem? And update to the latest libxml2 libraries, they were quite some fixes lately regarding XSDs.

 [2005-02-21 19:56 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 10:03:34 2021 UTC