php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44111 get_object_vars() produces different output with 5.2.3 and 5.2.5
Submitted: 2008-02-13 17:05 UTC Modified: 2008-02-13 17:14 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:0 of 0 (0.0%)
From: leandro dot rhcp99 at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Ubuntu 7.10
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: leandro dot rhcp99 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-02-13 17:05 UTC] leandro dot rhcp99 at gmail dot com
Description:
------------
I'm php user and move my php projects from 5.2.3 to 5.2.5. In this changing I've got some problems on function get_object_vars. And seeing the changelog (http://bugs.php.net/bug.php?id=40757) I've noted that have some changes on this function.

Reproduce code:
---------------
class Modelo {
 
  public function __construct() {
      echo "Construtor Teste:<br />";
      echo "<pre>";
          print_r(array_keys(get_object_vars($this)));
      echo "</pre>";
  }
}
class Teste extends Modelo {
    //Atributte
   private $atributo1;
    private $atributo2;

    public function setAtributo1($atributo1) {
        $this->atributo1 = $atributo1;
    }
    public function getAtributo1(){
        return $this->atributo1;
    }
    public function setAtributo2($atributo2) {
        $this->atributo2 = $atributo2;
    }
    public function getAtributo2(){
        return $this->atributo2;
    }
}
$objeto = new Teste();              

Expected result:
----------------
Array
(
   [0] => atributo1
   [1] => atributo2
)

Actual result:
--------------
Array
(
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-13 17:14 UTC] jani@php.net
change the "private" to "public" and it works like you expect. No bug here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 23:00:03 2025 UTC