php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46605 isset does not work correctly after ArrayObject
Submitted: 2008-11-18 22:03 UTC Modified: 2008-11-18 23:23 UTC
From: roman dot tvrdy at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: Linux - Gentoo
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: roman dot tvrdy at gmail dot com
New email:
PHP Version: OS:

 

 [2008-11-18 22:03 UTC] roman dot tvrdy at gmail dot com
Description:
------------
Function isset does not work identically for object created by ArrayObject(). For example code I have this output :


object(ArrayObject)[1]
  public 'aa' => string 'some content' (length=12)

ko : isset does not work after ArrayObject()

object(stdClass)[2]
  public 'aa' => string 'some content' (length=12)

ok : isset work after (object)

Reproduce code:
---------------
$content = array('aa' => 'some content');

// ********************************* //

$prm = new ArrayObject($content);
var_dump($prm);

if (isset($prm->aa) === true) echo 'ok : isset work after ArrayObject()';
else echo 'ko : isset does not work after ArrayObject()';

// ********************************* //

$prm = (object) $content;
var_dump($prm);

if (isset($prm->aa) === true) echo 'ok : isset work after (object)';
else echo 'ko : isset does not work after (object)';


Expected result:
----------------
Same behavior for both use.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-18 23:23 UTC] lbarnaud@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Try isset($prm['aa'])
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Nov 24 20:00:01 2025 UTC