From:             morten at nilsen dot com
Operating system: Linux
PHP version:      5.0.1
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Weird behaviour of __set($name, $value);

Description:
------------
The attached script behaves ilogically


Reproduce code:
---------------
<?php
  class template {
    function __set($name, $value) {
      echo "Set $name to $value<br>";
      if($name[0] != '&') $name = '&'.$name.';';
    }
  }

  function fetchlist($name) {
    global $template;

    echo '$template->what = '.$name.'<br>';
    $template->what = $name;

  } 

  $template = new template();
  fetchlist('user');
  fetchlist('group');
?>

Expected result:
----------------
$template->what = user
Set what to user
$template->what = group
Set what to group

Actual result:
--------------
$template->what = user
Set what to user
$template->what = group
Set &what; to group

-- 
Edit bug report at http://bugs.php.net/?id=29767&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29767&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29767&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29767&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29767&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29767&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29767&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29767&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29767&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29767&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29767&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29767&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29767&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29767&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29767&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29767&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29767&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29767&r=float

Reply via email to