Bug #67807 [Fbk->Opn]: Object passed by reference becomes a string
| From: | atlantisnova at gmail dot com | Date: | Fri, 08 Aug 2014 18:04:36 +0000 |
| Subject: | Bug #67807 [Fbk->Opn]: Object passed by reference becomes a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187033@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67807&edit=1
ID: 67807
User updated by: atlantisnova at gmail dot com
Reported by: atlantisnova at gmail dot com
Summary: Object passed by reference becomes a string
-Status: Feedback
+Status: Open
Type: Bug
Package: Class/Object related
Operating System: Debian Linux
PHP Version: 5.4.4
Block user comment: N
Private report: N
New Comment:
Sure here you go:
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
json
libxml
mbstring
mcrypt
memcache
mhash
mysql
mysqli
newrelic
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
Xdebug
I also tried xdebug_disable(); but the issue was still there. Thanks for looking into this!
I'll try disabling xdebug in php.ini and restarting apache next...
Previous Comments:
------------------------------------------------------------------------
[2014-08-08 17:45:08] aharvey@php.net
I can't reproduce this at all in a Debian Stable x86-64 VM with either the Debian package or a
stock 5.4.4 install (tested both with and without xdebug).
Can you provide the full list of modules enabled (php -m), please?
------------------------------------------------------------------------
[2014-08-08 17:31:33] requinix@php.net
What about with Xdebug disabled?
------------------------------------------------------------------------
[2014-08-08 17:28:24] atlantisnova at gmail dot com
More info: my system is a virtualized debian 64 bit machine running on a Mac,,, the production
server where we discovered the problem is an dedicated debian 64 box (php versions listed in
original comment).
Sorry for not posting the exact output before!
Here's a modified script that shows the correct value of $b before the notice:
class A{
function do_stuff(&$b) {
var_dump('Before in function:', $b);
$defined = 0;
#trigger_error("If I fixed the undefined variable but enabled this line instead, it will also
turn b from an object into a string! So user-triggered notices bork it as well.");
$x = $undefined || $defined ? 14 : 0;
var_dump('After in function:', $b);
}
}
class B{}
$a = new A();
$b = new B();
$a->do_stuff($b);
var_dump('After function:', $b);
--------------- output of above ------------------
string 'Before in function:' (length=19)
object(B)[10]
( ! ) Notice: Undefined variable: undefined in /vagrant/src/temp.tmp.php on line 7
Call Stack
# Time Memory Function Location
1 0.1017 4382640 {main}( ) ../temp.tmp.php:0
2 0.1018 4385776 A->do_stuff( ) ../temp.tmp.php:17
string 'After in function:' (length=18)
string 'B' (length=1)
string 'After function:' (length=15)
string 'B' (length=1)
------------------------------------------------------------------------
[2014-08-08 17:22:55] atlantisnova at gmail dot com
Yes it's exact and sure here's the output:
( ! ) Notice: Undefined variable: undefined in /vagrant/src/temp.tmp.php on line 6
Call Stack
# Time Memory Function Location
1 0.0631 4382248 {main}( ) ../temp.tmp.php:0
2 0.0631 4385384 A->do_stuff( ) ../temp.tmp.php:16
string 'In function:' (length=12)
string 'B' (length=1)
string 'After function:' (length=15)
string 'B' (length=1)
------------------------------------------------------------------------
[2014-08-08 17:18:15] requinix@php.net
http://3v4l.org/VqsdQ Works for me.
That's the exact repro script you used? And rather than some description of the actual result,
how about posting the actual, actual result?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=67807
--
Edit this bug report at https://bugs.php.net/bug.php?id=67807&edit=1