php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67621 property_exists is broken
Submitted: 2014-07-15 12:10 UTC Modified: 2018-02-18 08:36 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: djokodonev at gmail dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.5.14 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2014-07-15 12:10 UTC] djokodonev at gmail dot com
Description:
------------
property_exists functio is not working.



Test script:
---------------
<?php
$XML = simplexml_load_string($someRawXmlString, 'SimpleXMLElement', LIBXML_NOCDATA);
$data = json_decode(json_encode($XML));
$obj = $data;

if (property_exists($data, 'some_property')) {

}

?>

The above code will not work for some weird reason. The same goes for DateTime class.

<?php

$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $datetime1->diff($datetime2);

var_dump(property_exists($interval, 'm')) //false when the property exists;

?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-17 22:20 UTC] yohgaki@php.net
-Status: Open +Status: Verified
 [2014-07-17 22:20 UTC] yohgaki@php.net
http://3v4l.org/S2Ijn

This may be a dup.
 [2018-02-18 08:36 UTC] jhdxr@php.net
-Status: Verified +Status: Duplicate
 [2018-02-18 08:36 UTC] jhdxr@php.net
fixed in #69587
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC