PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_Util » Bug #9561

Not allowing underscores in middle of tags

Details

Submitted2006-12-06 15:44 UTC
Fromdarren at cwebd dot co dot uk
Assignedschst
StatusClosed
PackageXML_Util
PHP Version5.2.0 RC4
OSLinux 2.6.10 - Debian Sarge
Roadmaps(Not assigned)

Comments

[2006-12-06 15:44 UTC] darren at cwebd dot co dot uk

Description:
------------
When a tag name such as "TEST_UNDERSCORE" is passed to XML_Util::isValidName the test fails due to a regex error.

Test script:
---------------
$result = XML_Util::isValidName("TEST_UNDERSCORE");
if (PEAR::isError($result)) {
print "Invalid XML name: " . $result->getMessage();
}

FIX:

Line:753 change to:

if (!preg_match('/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?[[:alpha:]_]([[:alnum:]\_\-\.]+)?$/', $string)) {

Expected result:
----------------
isValidName should return true

Actual result:
--------------
isValidName should return's false