|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22345 XSL error when evaluating an empty path
Submitted: 2003-02-20 22:15 UTC Modified: 2003-02-21 00:41 UTC
From: reedc at aap dot com dot au Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5CVS-2003-02-20 (dev) OS: Windows 2000
Private report: No CVE-ID: None
 [2003-02-20 22:15 UTC] reedc at aap dot com dot au
xslt_process() chucks an undefined (no error text) error when an xpath selection is not found. The result should be empty.

For instance, if you were trying to use this stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:output method="text" omit-xml-declaration="yes"/> 
	<xsl:template match="/">

<xsl:for-each select="peas/porridge/ninedaysold">
<xsl:value-of select="." />


on the following xml:
<?xml version="1.0" encoding="UTF-8"?>

The result should be nothing. Instead the process chucks an error.

If you use other XSL selections to find the same thing conditionally, such as xsl:if, the result is the same.

If XML elements are optional, then any file not containing them will cause an error with the current php_xslt.dll

The XML/XSL files that produce an error with PHP5x (latest snap). Have worked fine with the past several interations of PHP 4x.

PHP: 5x
Apache 2
Sablotron: 0.97



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-21 00:41 UTC] reedc at aap dot com dot au
This is not an error with XSLT. It is an error with my brain (and code).

Apologies ... and thanks.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jun 24 03:01:23 2021 UTC