php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #17752 get_object_vars behaviour changed
Submitted: 2002-06-13 15:46 UTC Modified: 2003-01-18 19:20 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: michael at kimsal dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.0 OS: all
Private report: No CVE-ID: None
 [2002-06-13 15:46 UTC] michael at kimsal dot com
We have class code such as the following:

class foo {

var $bar1;
var $bar2;
var $bar3;

}

Per the documentation, and previous experience, if I put a value only in $bar2, get_object_vars() on the foo object would return only $bar2.  In PHP4.2.1 the behaviour now returns bar1, bar2 and bar3, regardless of whether they have values or not.  This is contrary to the documentation, and was extremely annoying to try to track down to boot.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-13 17:59 UTC] derick@php.net
This is correct behavior (and yes, it changed), making it a documentation problem.

Derick
 [2002-07-01 18:34 UTC] nick_eby at bonzidev dot com
I'd like to point out that changing behavior of such a function puts quite a lot of pressure on developers, who don't always get notified that such a change was made, to find the source of horrendous bugs that result from the change.  If anybody can explain to me the wisdom of making such a drastic change in this functionality, I'd love to hear it.  Not changing the documentation only adds to the confusion.
Just writing to say "Me too-- and it hurt, dammit!"
 [2002-07-02 02:13 UTC] derick@php.net
The function itself didn't change, but the implementation in the Engine did, because it was broken before.
 [2002-07-03 19:32 UTC] nick_eby at bonzidev dot com
I'm not convinced.  I think this has more to do with bug #15602 than with anything being "broken" previous to 4.2.1.  Whoever who implemented that feature request altered the behavior of get_object_vars() to suit his/her needs because they thought it'd be nice to have get_object_vars() return empty vars.
 [2003-01-18 19:20 UTC] philip@php.net
Thanks for the report, this PHP 4.2.0 change has been documented.

http://cvs.php.net/cvs.php/phpdoc/en/reference/classobj/functions/get-object-vars.xml

Thanks for the report :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 06:01:30 2024 UTC