php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32743 Error with type of 2nd parameter when creating DOMDocument()
Submitted: 2005-04-18 16:27 UTC Modified: 2005-04-18 21:52 UTC
From: jj at intelequest dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.4 OS: Windows XP
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jj at intelequest dot com
New email:
PHP Version: OS:

 

 [2005-04-18 16:27 UTC] jj at intelequest dot com
Description:
------------
When executing the demo code found at http://www.php.net/manual/en/function.dom-domdocument-construct.php I obtain the error message.

"Warning: domdocument() expects parameter 2 to be long"

My understanding (from the online docs) is that the 2nd parameter is to be of type string.

Also, according to the documentation, this is the php 5 replacment to DOM_XML i.e. this is DOM XML. Note that there is no sub-category for just DOM so the next logical place to put errors such as these would be either DOM XML or Documentation bug.



Reproduce code:
---------------
<?PHP
$dom = new DOMDocument('1.0', 'iso-8859-1');
echo $dom->saveXML();
?>



Expected result:
----------------
<?xml version="1.0" encoding="iso-8859-1"?>

Actual result:
--------------
Warning: domdocument() expects parameter 2 to be long, string given in C:\temp\test_xml.php on line 2

Fatal error: Call to undefined method domdocument::saveXML() in C:\temp\test_xml.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-18 16:44 UTC] jj at intelequest dot com
The reproduce code is as follows:

$dom = new DOMDocument('1.0', 'iso-8859-1');
echo $dom->saveXML();
 [2005-04-18 20:51 UTC] chregu@php.net
Looks like you're testing that against PHP 4.3.

I get exactly your error with PHP 4.3, but not with PHP 5...
 [2005-04-18 21:11 UTC] jj at intelequest dot com
Sorry .. testing with 5.0.4.

PHP 5.0.4 (cli) (built: Mar 31 2005 02:45:48)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
    with Zend Extension Manager v1.0.7, Copyright (c) 2003-2004, by Zend Technologies
    with Zend Optimizer v2.5.8, Copyright (c) 1998-2004, by Zend Technologies
    with Zend Debugger v4.0.0, Copyright (c) 1999-2005, by Zend Technologies
 [2005-04-18 21:14 UTC] derick@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


 [2005-04-18 21:18 UTC] jj at intelequest dot com
k .. 

took out zend extensions .. 

C:\temp>php -v
PHP 5.0.4 (cli) (built: Mar 31 2005 02:45:48)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

C:\temp>php test_xml.php

Warning: domdocument() expects parameter 2 to be long, string given in C:\temp\test_xml.php on line 3

Fatal error: Call to undefined method domdocument::saveXML() in C:\temp\test_xml.php on line 4


still gives an error ..
 [2005-04-18 21:27 UTC] jj at intelequest dot com
My bad folks.... 

extension=php_domxml.dll 

was still active and caused this issue.

I apologize for the wasted time. =(
 [2005-04-18 21:29 UTC] chregu@php.net
Did you load  php_domxml.dll instead if php_dom.dll?


 [2005-04-18 21:38 UTC] jj at intelequest dot com
Yes, the problem was with my php.ini whereby I was loading the php_domxml.dll in the extensions. Once I removed that from the extensions and restarted the web service all was good with instantiating that DOMDocument() object.
 [2005-04-18 21:52 UTC] amt@php.net
Not a real bug -> setting status to Bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC