From:             kudung at gmx dot net
Operating system: Debian 4
PHP version:      5.2.5
PHP Bug Type:     Class/Object related
Bug description:  Function Parameters as non reference resets orignial Value

Description:
------------
Hi,

just discovered that an parameter wich passed to an function as an non
reference of type object is handeld as an reference,
but if i pass a parameter of type array to the function it is handled
as a copie as it should be.

Reproduce code:
---------------
class foob {
  function testbar( $das )
  {
    unset( $das->ding );
  }
}

function testbar( $das )
{
  unset( $das->ding );
}

$ers = new stdClass();
$ers->ding = '323';
testbar($ers);
var_dump( $ers );

$ers2 = new stdClass();
$ers2->ding = '323';
$foob = new foob();
$foob->testbar($ers2);
var_dump( $ers2  );



Expected result:
----------------
Expected that properties still exists:
object(stdClass)#1 (1) { ["ding"]=>  string(3) "323" } object(stdClass)#2
(1) { ["ding"]=>  string(3) "323" }

Actual result:
--------------
Output:
object(stdClass)#1 (0) { } 
object(stdClass)#2 (0) { }

-- 
Edit bug report at http://bugs.php.net/?id=44677&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44677&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44677&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44677&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44677&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44677&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44677&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44677&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44677&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44677&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44677&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44677&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44677&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44677&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44677&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44677&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44677&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44677&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44677&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44677&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44677&r=mysqlcfg

Reply via email to