php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32438 simplexml_import_dom() (and only it) note recognized
Submitted: 2005-03-24 01:21 UTC Modified: 2005-04-02 16:58 UTC
From: franp at free dot fr Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.3 OS: FreeBSD 4.11
Private report: No CVE-ID: None
 [2005-03-24 01:21 UTC] franp at free dot fr
Description:
------------
While all simplexml functions are working fine, simplexml_import_dom just fails as if a non-existing function.

Reproduce code:
---------------
$doc = new DomDocument;
$doc->preserveWhiteSpace = TRUE;
	
$doc->loadXML($result);
	
$s = simplexml_load_string($result); // pass
	
$test = dom_import_simplexml($s); // pass
	
$s = simplexml_import_dom($doc); // broken ! 


Expected result:
----------------
Was working with PHP 5.0.0.
Apparently broke when passing to PHP 5.0.3.

Actual result:
--------------
Error code :
Fatal error: Call to undefined function simplexml_import_dom()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-24 07:45 UTC] sniper@php.net
You haven't build ext/dom in. Just add --with-dom to your configure line..

 [2005-03-24 13:20 UTC] franp at free dot fr
OK but then shouldn't you pass that to a documentation "bug" or "lack of precision" ?

The current manual states :
"
CXIII. SimpleXML functions
Installation
The SimpleXML extension is enabled by default. To disable it, use the --disable-simplexml configure option.
"

and

"
XXVII. DOM Functions
Installation 
There is no installation needed to use these functions; they are part of the PHP core.
"
 [2005-03-24 13:53 UTC] franp at free dot fr
Thinking of it again, I think you miss the point.
I am not talking of PHP 4, but PHP 5.
--with-dom is used to add the old DOM XML to PHP 4, not to PHP 5 (or am I wrong ?) .

I am spkeaking of PHP 5.0.3 and the new built-in SimpleXML and DOM functions.

So I re-explain what happens : all SimpleXML functions (and PHP5 XML functions) work correctly, ONLY simplexml_import_dom() fails. That is the strange point.

new DomDocument works ; simplexml_load_string() works, access to the xml elements using the SimpleXML syntax (echo $s->racine->anelement) works. But simple_import_dom() fails and only that.
 [2005-03-24 14:02 UTC] tony2001@php.net
>--with-dom is used to add the old DOM XML to PHP 4, not to 
>PHP 5 (or am I wrong ?) .
yes, you're wrong. 
your PHP basically was built without DOM support, as it was said.
 [2005-04-02 16:58 UTC] franp at free dot fr
Could someone explain me how my PHp can be built "basically without DOM support" but :

$doc = new DomDocument;   // Work OK
$doc->loadXML($result);   // Work OK
$s = simplexml_load_string($result);   // Work OK
$countNodes = count($s2->xpath('ancestor::*')); // Work OK
etc...
etc...

??

ALL DOM and SimpleXML functions DO Work !
ONLY $s = simplexml_import_dom($doc) FAILS !

It is hard to beleive my PHP was build without DOM support when ALL DOM functions (except one) are working OK !
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC