php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49647 DOMUserData does not exist
Submitted: 2009-09-23 22:00 UTC Modified: 2009-09-24 13:35 UTC
From: [email protected] Assigned:
Status: Closed Package: Reflection related
PHP Version: 5.3.0 OS: Linux
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: [email protected]
New email:
PHP Version: OS:

 

 [2009-09-23 22:00 UTC] [email protected]
Description:
------------
Reflection actitivy against a child of DOMElement can result in:

"ReflectionException: Class DOMUserData does not exist"

presumably due to dom_node_get_user_data in ext/dom/node.c.

The actual class does not appear to exist, although the method shows it as a datatype for a parameter.

Reproduce code:
---------------
<?php
$r2 = new ReflectionClass('DOMUserData');
echo r2->getName();
?>


Expected result:
----------------
DOMUserData

Actual result:
--------------
ReflectionException: Class DOMUserData does not exist

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-24 10:03 UTC] [email protected]
Is ext/dom enabled in your build? And loaded? :)
 [2009-09-24 11:31 UTC] [email protected]
Yes, ext/dom is enabled ---------------------------------------------:
$ php -i | grep -i dom
dom
DOM/XML => enabled
DOM/XML API Version => 20031129


I'll modify the test script to verify it also ----------------------:
<?php
echo 'Verify DOM is loaded:' . PHP_EOL;
$r1 = new ReflectionClass('DOMElement');
var_dump($r1->getName());
echo PHP_EOL;

echo 'Does DOMUserData exist?' . PHP_EOL;
$r2 = new ReflectionClass('DOMUserData');
var_dump($r2->getName());
?>

With expected output ------------------------------------------------:
Verify DOM is loaded:
string(10) "DOMElement"

Does DOMUserData exist?
string(11) "DOMUserData"

And actual output ---------------------------------------------------:
Verify DOM is loaded:
string(10) "DOMElement"

Does DOMUserData exist?
PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class DOMUserData does not exist' in /opt/phpversions/php-bin/php-5.3.0/test.php:8
Stack trace:
#0 /opt/phpversions/php-bin/php-5.3.0/test.php(8): ReflectionClass->__construct('DOMUserData')
#1 {main}
  thrown in /opt/phpversions/php-bin/php-5.3.0/test.php on line 8

ReflectionException: Class DOMUserData does not exist in /opt/phpversions/php-bin/php-5.3.0/test.php on line 8

Call Stack:
    0.0002     624160   1. {main}() /opt/phpversions/php-bin/php-5.3.0/test.php:0
    0.0004     625432   2. ReflectionClass->__construct() /opt/phpversions/php-bin/php-5.3.0/test.php:8


This bug report was prompted by PEAR bug #14640, where phpDocumenter encounters the same ReflectionException when attempting to document the DOMElement parent class of a user's code class that extends DOMElement.  Declaring an empty dummy DOMUserData class in the user's code solves the issue.
 [2009-09-24 13:18 UTC] [email protected]
Automatic comment from SVN on behalf of rrichards
Revision: http://svn.php.net/viewvc/?view=revision&revision=288654
Log: Fixed bug #49647 (DOMUserData does not exist)
 [2009-09-24 13:19 UTC] [email protected]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

type is mixed not DOMUserData
 [2009-09-24 13:35 UTC] [email protected]
Thanks Rob... any chance you could also patch it on the 5_2 branch?
 [2009-09-24 15:10 UTC] [email protected]
Automatic comment from SVN on behalf of rrichards
Revision: http://svn.php.net/viewvc/?view=revision&revision=288658
Log: MFH: Fixed bug #49647 (DOMUserData does not exist)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jun 29 06:01:33 2025 UTC