Edit report at http://bugs.php.net/bug.php?id=52382&edit=1

 ID:               52382
 Comment by:       giorgio dot liscio at email dot it
 Reported by:      giorgio dot liscio at email dot it
 Summary:          NULL in method arguments is casted to string?
 Status:           Bogus
 Type:             Bug
 Package:          DOM XML related
 Operating System: all ? xp x64
 PHP Version:      5.3.2

 New Comment:

i don't think that is like you think



if i extend appendChild





override appendChild($name, $content = NULL, $myNewArg = NULL)



if i want to skip the second argument i can not



or another issue:



as php doc says



DOMImplementation->createDocument  ([  string $namespaceURI = NULL  [, 
string $qualifiedName = NULL  [,  DOMDocumentType $doctype = NULL  ]]]
)



third parameter is optional (=NULL)



but if i do



$x->createDocument(null, null, null); to create an empty document 



exception is thrown:



Argument 3 passed to DOMImplementation::createDocument() must be an
instance of DOMDocumentType, null given



if i do createDocument(); obviously works, but the concept of "skipping
not required parameters with null" is not respected


Previous Comments:
------------------------------------------------------------------------
[2010-07-20 09:59:01] ahar...@php.net

They're not equivalent: you're providing a value for the "value"

parameter to DOMDocument::createElement(), so yes, it will get coerced

into an empty string using PHP's usual type juggling mechanism.

------------------------------------------------------------------------
[2010-07-20 09:46:25] giorgio dot liscio at email dot it

Description:
------------
hi, test this:



header("Content-Type: text/plain");



$doc = new \DOMDocument()

$doc->appendChild($doc->createElement("root", NULL));

echo $doc->saveXML();



echo "\n\nshould be equivalent to:\n\n";



$doc = new \DOMDocument()

$doc->appendChild($doc->createElement("root"));

echo $doc->saveXML();



i hope other DOM methods will work good... otherwise fix is needed



thank you!



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52382&edit=1

Reply via email to