rrichards Thu May 27 07:15:45 2004 EDT
Added files:
/php-src/ext/dom/tests dom_create_element.phpt
Modified files:
/php-src/ext/dom document.c element.c entityreference.c php_dom.c
processinginstruction.c
Log:
namespace/tagname validation fixes (Adam Trachtenberg)
added new test
http://cvs.php.net/diff.php/php-src/ext/dom/document.c?r1=1.52&r2=1.53&ty=u
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.52 php-src/ext/dom/document.c:1.53
--- php-src/ext/dom/document.c:1.52 Sun May 16 06:30:16 2004
+++ php-src/ext/dom/document.c Thu May 27 07:15:44 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c,v 1.52 2004/05/16 10:30:16 rrichards Exp $ */
+/* $Id: document.c,v 1.53 2004/05/27 11:15:44 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -759,8 +759,8 @@
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
- if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Element name is
required");
+ if (xmlValidateName((xmlChar *) name, 0) != 0) {
+ php_dom_throw_error(INVALID_CHARACTER_ERR,
dom_get_strict_error(intern->document) TSRMLS_CC);
RETURN_FALSE;
}
@@ -908,6 +908,11 @@
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
+ if (xmlValidateName((xmlChar *) name, 0) != 0) {
+ php_dom_throw_error(INVALID_CHARACTER_ERR,
dom_get_strict_error(intern->document) TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
node = xmlNewPI((xmlChar *) name, (xmlChar *) value);
if (!node) {
RETURN_FALSE;
@@ -939,8 +944,8 @@
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
- if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name is
required");
+ if (xmlValidateName((xmlChar *) name, 0) != 0) {
+ php_dom_throw_error(INVALID_CHARACTER_ERR,
dom_get_strict_error(intern->document) TSRMLS_CC);
RETURN_FALSE;
}
@@ -974,6 +979,11 @@
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
+ if (xmlValidateName((xmlChar *) name, 0) != 0) {
+ php_dom_throw_error(INVALID_CHARACTER_ERR,
dom_get_strict_error(intern->document) TSRMLS_CC);
+ RETURN_FALSE;
+ }
+
node = xmlNewReference(docp, name);
if (!node) {
RETURN_FALSE;
@@ -1073,23 +1083,22 @@
return;
}
- if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Element Name is
required");
- RETURN_FALSE;
- }
-
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
errorcode = dom_check_qname(name, &localname, &prefix, uri_len, name_len);
if (errorcode == 0) {
- nodep = xmlNewDocNode (docp, NULL, localname, NULL);
- if (nodep != NULL && uri != NULL) {
- nsptr = xmlSearchNsByHref (nodep->doc, nodep, uri);
- if (nsptr == NULL) {
- nsptr = dom_get_ns(nodep, uri, &errorcode, prefix);
+ if (xmlValidateName((xmlChar *) localname, 0) == 0) {
+ nodep = xmlNewDocNode (docp, NULL, localname, NULL);
+ if (nodep != NULL && uri != NULL) {
+ nsptr = xmlSearchNsByHref (nodep->doc, nodep, uri);
+ if (nsptr == NULL) {
+ nsptr = dom_get_ns(nodep, uri, &errorcode,
prefix);
+ }
+ xmlSetNs(nodep, nsptr);
}
- xmlSetNs(nodep, nsptr);
+ } else {
+ errorcode = INVALID_CHARACTER_ERR;
}
}
@@ -1138,24 +1147,23 @@
return;
}
- if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Qualified Name is
required");
- RETURN_FALSE;
- }
-
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
root = xmlDocGetRootElement(docp);
if (root != NULL) {
errorcode = dom_check_qname(name, &localname, &prefix, uri_len,
name_len);
if (errorcode == 0) {
- nodep = (xmlNodePtr) xmlNewDocProp(docp, localname, NULL);
- if (nodep != NULL && uri_len > 0) {
- nsptr = xmlSearchNsByHref (nodep->doc, root, uri);
- if (nsptr == NULL) {
- nsptr = dom_get_ns(root, uri, &errorcode,
prefix);
+ if (xmlValidateName((xmlChar *) localname, 0) == 0) {
+ nodep = (xmlNodePtr) xmlNewDocProp(docp, localname,
NULL);
+ if (nodep != NULL && uri_len > 0) {
+ nsptr = xmlSearchNsByHref (nodep->doc, root,
uri);
+ if (nsptr == NULL) {
+ nsptr = dom_get_ns(root, uri,
&errorcode, prefix);
+ }
+ xmlSetNs(nodep, nsptr);
}
- xmlSetNs(nodep, nsptr);
+ } else {
+ errorcode = INVALID_CHARACTER_ERR;
}
}
} else {
http://cvs.php.net/diff.php/php-src/ext/dom/element.c?r1=1.28&r2=1.29&ty=u
Index: php-src/ext/dom/element.c
diff -u php-src/ext/dom/element.c:1.28 php-src/ext/dom/element.c:1.29
--- php-src/ext/dom/element.c:1.28 Sun May 16 06:30:16 2004
+++ php-src/ext/dom/element.c Thu May 27 07:15:44 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c,v 1.28 2004/05/16 10:30:16 rrichards Exp $ */
+/* $Id: element.c,v 1.29 2004/05/27 11:15:44 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -58,7 +58,7 @@
{NULL, NULL, NULL}
};
-/* {{{ proto void DomElement::__construct(string name, [string value]); */
+/* {{{ proto void DomElement::__construct(string name, [string value], [string uri]);
*/
PHP_METHOD(domelement, __construct)
{
@@ -106,6 +106,14 @@
RETURN_FALSE;
}
} else {
+ /* If you don't pass a namespace uri, then you can't set a prefix */
+ localname = xmlSplitQName2(name, (xmlChar **) &prefix);
+ if (prefix != NULL) {
+ xmlFree(localname);
+ xmlFree(prefix);
+ php_dom_throw_error(NAMESPACE_ERR, 1 TSRMLS_CC);
+ RETURN_FALSE;
+ }
nodep = xmlNewNode(NULL, (xmlChar *) name);
}
http://cvs.php.net/diff.php/php-src/ext/dom/entityreference.c?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/dom/entityreference.c
diff -u php-src/ext/dom/entityreference.c:1.9 php-src/ext/dom/entityreference.c:1.10
--- php-src/ext/dom/entityreference.c:1.9 Sun May 16 06:30:16 2004
+++ php-src/ext/dom/entityreference.c Thu May 27 07:15:45 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entityreference.c,v 1.9 2004/05/16 10:30:16 rrichards Exp $ */
+/* $Id: entityreference.c,v 1.10 2004/05/27 11:15:45 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,7 +48,7 @@
xmlNodePtr oldnode = NULL;
dom_object *intern;
char *name;
- int name_len;
+ int name_len, name_valid;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
&id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) {
@@ -57,7 +57,9 @@
}
php_std_error_handling();
- if (name_len == 0) {
+
+ name_valid = xmlValidateName((xmlChar *) name, 0);
+ if (name_valid != 0) {
php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
RETURN_FALSE;
}
http://cvs.php.net/diff.php/php-src/ext/dom/php_dom.c?r1=1.58&r2=1.59&ty=u
Index: php-src/ext/dom/php_dom.c
diff -u php-src/ext/dom/php_dom.c:1.58 php-src/ext/dom/php_dom.c:1.59
--- php-src/ext/dom/php_dom.c:1.58 Sun May 16 06:30:16 2004
+++ php-src/ext/dom/php_dom.c Thu May 27 07:15:45 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.58 2004/05/16 10:30:16 rrichards Exp $ */
+/* $Id: php_dom.c,v 1.59 2004/05/27 11:15:45 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1229,34 +1229,62 @@
}
/* }}} end dom_set_old_ns */
-int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int
name_len) {
- int errorcode = 0;
+/*
+http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
- if (name_len > 0) {
- *localname = xmlSplitQName2(qname, (xmlChar **) prefix);
- if (*localname == NULL) {
- *localname = xmlStrdup(qname);
- if (*prefix == NULL && uri_len == 0) {
- return errorcode;
- }
- }
- if (uri_len == 0 || *localname == NULL || (xmlStrchr(*localname,
(xmlChar) ':') != NULL)) {
- errorcode = NAMESPACE_ERR;
+NAMESPACE_ERR: Raised if
+
+1. the qualifiedName is a malformed qualified name
+2. the qualifiedName has a prefix and the namespaceURI is null
+*/
+
+/* {{{ int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len,
int name_len) */
+int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int
name_len) {
+ if (name_len == 0) {
+ return NAMESPACE_ERR;
+ }
+
+ *localname = xmlSplitQName2(qname, (xmlChar **) prefix);
+ if (*localname == NULL) {
+ *localname = xmlStrdup(qname);
+ if (*prefix == NULL && uri_len == 0) {
+ return 0;
}
- } else {
- errorcode = NAMESPACE_ERR;
}
- return errorcode;
+ /* 1 */
+ if (xmlValidateQName((xmlChar *) qname, 0) != 0) {
+ return NAMESPACE_ERR;
+ }
+
+ /* 2 */
+ if (*prefix != NULL && uri_len == 0) {
+ return NAMESPACE_ERR;
+ }
+
+ return 0;
}
+
+/*
+http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
+
+NAMESPACE_ERR: Raised if
+
+3. the qualifiedName has a prefix that is "xml" and the namespaceURI is different
from "http://www.w3.org/XML/1998/namespace" [XML Namespaces]
+4. the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from
"http://www.w3.org/2000/xmlns/"
+5. the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName
nor its prefix is "xmlns".
+*/
+
/* {{{ xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix)
*/
xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) {
xmlNsPtr nsptr = NULL;
*errorcode = 0;
- if (! (prefix && !strcmp (prefix, "xml") && strcmp(uri, XML_XML_NAMESPACE))) {
+ if (! ((prefix && !strcmp (prefix, "xml" ) && strcmp(uri, XML_XML_NAMESPACE))
||
+ (prefix && !strcmp (prefix, "xmlns") && strcmp(uri,
DOM_XMLNS_NAMESPACE)) ||
+ (prefix && !strcmp(uri, DOM_XMLNS_NAMESPACE) && strcmp (prefix,
"xmlns")))) {
nsptr = xmlNewNs(nodep, uri, prefix);
}
http://cvs.php.net/diff.php/php-src/ext/dom/processinginstruction.c?r1=1.13&r2=1.14&ty=u
Index: php-src/ext/dom/processinginstruction.c
diff -u php-src/ext/dom/processinginstruction.c:1.13
php-src/ext/dom/processinginstruction.c:1.14
--- php-src/ext/dom/processinginstruction.c:1.13 Sun May 16 06:30:16 2004
+++ php-src/ext/dom/processinginstruction.c Thu May 27 07:15:45 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: processinginstruction.c,v 1.13 2004/05/16 10:30:16 rrichards Exp $ */
+/* $Id: processinginstruction.c,v 1.14 2004/05/27 11:15:45 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,7 +48,7 @@
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
char *name, *value = NULL;
- int name_len, value_len;
+ int name_len, value_len, name_valid;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s",
&id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) ==
FAILURE) {
@@ -57,7 +57,9 @@
}
php_std_error_handling();
- if (name_len == 0) {
+
+ name_valid = xmlValidateName((xmlChar *) name, 0);
+ if (name_valid != 0) {
php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
RETURN_FALSE;
}
http://cvs.php.net/co.php/php-src/ext/dom/tests/dom_create_element.phpt?r=1.1&p=1
Index: php-src/ext/dom/tests/dom_create_element.phpt
+++ php-src/ext/dom/tests/dom_create_element.phpt
--TEST--
Test 1: Creating Elements with and without Namespaces
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
print " 1 DOMDocument::createElement('valid')\n";
try {
$dom = new domDocument;
$dom->createElement('valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 2 DOMDocument::createElement('-invalid')\n";
try {
$dom = new domDocument;
$dom->createElement('-invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 3 DOMDocument::createElement(' ')\n";
try {
$dom = new domDocument;
$dom->createElement(' ');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 4 DOMDocument::createElement('prefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElement('prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 5 DOMDocument::createElementNS('http://valid.com', 'valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', 'valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', 'prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 7 DOMDocument::createElementNS('http://valid.com', '-invalid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', '-invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', 'prefix:-invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print " 9 DOMDocument::createElementNS('', 'prefix:invalid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('', 'prefix:invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', 'prefix:valid:invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://valid.com', '-prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "12 DOMDocument::createElementNS('-', 'prefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('-', 'prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "13 DOMElement::__construct('valid')\n";
try {
$element = new DomElement('valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "14 DOMElement::__construct('-invalid')\n";
try {
$element = new DomElement('-invalid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "15 DOMElement::__construct(' ')\n";
try {
$element = new DomElement(' ');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "16 DOMElement::__construct('prefix:valid')\n";
try {
$element = new DomElement('prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "17 DOMElement::__construct('valid', '', 'http://valid.com')\n";
try {
$element = new DomElement('valid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "18 DOMElement::__construct('prefix:valid', '', 'http://valid.com')\n";
try {
$element = new DomElement('prefix:valid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "19 DOMElement::__construct('-invalid', '', 'http://valid.com')\n";
try {
$element = new DomElement('-invalid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com')\n";
try {
$element = new DomElement('prefix:-invalid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "21 DOMElement::__construct('prefix:invalid', '', '')\n";
try {
$element = new DomElement('prefix:invalid', '', '');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com')\n";
try {
$element = new DomElement('prefix:valid:invalid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com')\n";
try {
$element = new DomElement('-prefix:valid', '', 'http://valid.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "24 DOMElement::__construct('prefix:valid', '', '-')\n";
try {
$element = new DomElement('prefix:valid', '', '-');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* the qualifiedName has a prefix and the namespaceURI is null */
print "25 DOMDocument::createElementNS('', 'prefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('', 'prefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* the qualifiedName has a prefix that is "xml" and the namespaceURI
is different from "http://www.w3.org/XML/1998/namespace" [XML Namespaces] */
print "26 DOMDocument::createElementNS('http://wrong.namespaceURI.com',
'xml:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://wrong.namespaceURI.com', 'xml:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com')\n";
try {
$element = new DomElement('xml:valid', '', 'http://wrong.namespaceURI.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* This is okay because we reuse the xml namespace from the document */
print "28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace',
'xml:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* This isn't because the xml namespace isn't there and we can't create it */
print "29 DOMElement::__construct('xml:valid', '',
'http://www.w3.org/XML/1998/namespace')\n";
try {
$element = new DomElement('xml:valid', '', 'http://www.w3.org/XML/1998/namespace');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* the qualifiedName or its prefix is "xmlns" and the namespaceURI is
different from "http://www.w3.org/2000/xmlns/" */
print "30 DOMDocument::createElementNS('http://wrong.namespaceURI.com',
'xmlns:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "31 DOMElement::__construct('xmlns:valid', '',
'http://wrong.namespaceURI.com')\n";
try {
$element = new DomElement('xmlns:valid', '', 'http://wrong.namespaceURI.com');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/',
'xmlns:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "33 DOMElement::__construct('xmlns:valid', '',
'http://www.w3.org/2000/xmlns/')\n";
try {
$element = new DomElement('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
/* the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the
qualifiedName nor its prefix is "xmlns". */
print "34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/',
'wrongprefix:valid')\n";
try {
$dom = new domDocument;
$dom->createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
print "35 DOMElement::__construct('wrongprefix:valid', '',
'http://www.w3.org/2000/xmlns/')\n";
try {
$element = new DomElement('wrongprefix:valid', '',
'http://www.w3.org/2000/xmlns/');
print "valid\n";
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
?>
--EXPECT--
1 DOMDocument::createElement('valid')
valid
2 DOMDocument::createElement('-invalid')
Invalid Character Error
3 DOMDocument::createElement(' ')
Invalid Character Error
4 DOMDocument::createElement('prefix:valid')
valid
5 DOMDocument::createElementNS('http://valid.com', 'valid')
valid
6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid')
valid
7 DOMDocument::createElementNS('http://valid.com', '-invalid')
Namespace Error
8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid')
Namespace Error
9 DOMDocument::createElementNS('', 'prefix:invalid')
Namespace Error
10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid')
Namespace Error
11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid')
Namespace Error
12 DOMDocument::createElementNS('-', 'prefix:valid')
valid
13 DOMElement::__construct('valid')
valid
14 DOMElement::__construct('-invalid')
Invalid Character Error
15 DOMElement::__construct(' ')
Invalid Character Error
16 DOMElement::__construct('prefix:valid')
Namespace Error
17 DOMElement::__construct('valid', '', 'http://valid.com')
valid
18 DOMElement::__construct('prefix:valid', '', 'http://valid.com')
valid
19 DOMElement::__construct('-invalid', '', 'http://valid.com')
Invalid Character Error
20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com')
Namespace Error
21 DOMElement::__construct('prefix:invalid', '', '')
Namespace Error
22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com')
Namespace Error
23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com')
Invalid Character Error
24 DOMElement::__construct('prefix:valid', '', '-')
valid
25 DOMDocument::createElementNS('', 'prefix:valid')
Namespace Error
26 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xml:valid')
Namespace Error
27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com')
Namespace Error
28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid')
valid
29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')
Namespace Error
30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid')
Namespace Error
31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com')
Namespace Error
32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid')
valid
33 DOMElement::__construct('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/')
valid
34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid')
Namespace Error
35 DOMElement::__construct('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/')
Namespace Error
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php