Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24932 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4994 invoked by uid 1010); 24 Jul 2006 15:54:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4979 invoked from network); 24 Jul 2006 15:54:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2006 15:54:27 -0000 X-PHP-List-Original-Sender: rishad@kaluma.com X-Host-Fingerprint: 196.26.21.246 mail.kaluma.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (1) Received: from ([196.26.21.246:52694] helo=mail.kaluma.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 9C/8D-04178-03DE4C44 for ; Mon, 24 Jul 2006 11:54:27 -0400 Received: from [192.168.0.109] (unknown [192.168.0.109]) by mail.kaluma.com (Postfix) with ESMTP id 711BD171F0C for ; Mon, 24 Jul 2006 17:51:51 +0200 (SAST) Message-ID: <44C4ECC6.8080401@kaluma.com> Date: Mon, 24 Jul 2006 17:52:38 +0200 User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Pass by reference (5.1.1 vs 5.1.2) From: rishad@kaluma.com (Rishad Omar) Hello, I've upgraded from 5.1.1 to 5.1.2 and discovered the following unexpected difference. Best shown by example. In php 5.1.1, the $p is passed correctly as reference and so returns with the value 12 in its first element. I regard this as correct behaviour. In php 5.1.2, the $p is passed by value. So on return, $p is still empty! This can be fixed as follows: $p = array(); getArray($p); The following example works, as expected, in both 5.1.1 and 5.1.2. i += 30; } doAmend($b = new A); print_r($b); // this prints the value of member i as 39 as expected. ?>