php.net |  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: 2020-04-21 11:32 UTC
From: gtisza at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Reflection related
PHP Version: 7.3.2 OS:
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gtisza at gmail dot com
New email:
PHP Version: OS:

 

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

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

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-21 11:32 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2020-04-21 11:32 UTC] cmb@php.net
Marking as duplicate of bug #79065 (of which this is a special
case).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC