php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27641 zend.ze1_compatibility_mode = On causes object properties to be misreported
Submitted: 2004-03-18 18:04 UTC Modified: 2004-03-24 07:54 UTC
From: brad at info-link dot net Assigned: andi
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.0RC1 OS: RedHat Linux 7.3
Private report: No CVE-ID:
 [2004-03-18 18:04 UTC] brad at info-link dot net
Description:
------------
When zend.ze1_compatibility_mode = On, the functions such as print_r and get_object_vars seem to always return the values from the _class_ variables, NOT the current _object_ variable values.  The problem doesn't seem to exist with zend.ze1_compatibility_mode = Off.


Reproduce code:
---------------
<?php
  class A {
    var $a = "Default for A";
    var $b = "Default for B";

    function __construct($a, $b) {
      $this->a = $a;
      $this->b = $b;
    }
    function A() {
      $args = func_get_args();
      call_user_func_array(Array(&$this, '__construct'), $args);
    }
  }

  $t = new A("New A", "New B");
  print_r($t);
  print_r(get_class_vars(get_class($t)));
  print_r(get_object_vars($t));
?>

Expected result:
----------------
a Object
(
    [a] => New A
    [b] => New B
)
Array
(
    [a] => Default for A
    [b] => Default for B
)
Array
(
    [a] => New A
    [b] => New B
)

Actual result:
--------------
A Object
(
    [a] => Default for A
    [b] => Default for B
)
Array
(
    [a] => Default for A
    [b] => Default for B
)
Array
(
    [a] => Default for A
    [b] => Default for B
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-19 02:46 UTC] derick@php.net
Reclassify as Zend Engine 2 problem, and assigning to Andi.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 09:02:29 2014 UTC