|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77685 Property reflection fails for DOMElement::$firstChild
Submitted: 2019-03-01 06:59 UTC Modified: -
From: gtisza at gmail dot com Assigned:
Status: Open Package: Reflection related
PHP Version: 7.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
41 - 15 = ?
Subscribe to this entry?

 [2019-03-01 06:59 UTC] gtisza at gmail dot com
Trying to use reflection for the firstChild property of a DOMElement throws a "Property DOMElement::$firstChild does not exist" ReflectionException.
Live test:

This is particularly disruptive when using PHPSpec, which wraps all property access into reflection checks.

Test script:
$doc = new DOMDocument;
$e = $doc->getElementsByTagname('html')->item(0);
echo get_class($e->firstChild); // DOMElement
new ReflectionProperty('DOMElement', 'firstChild'); // throws


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Nov 17 06:01:40 2019 UTC