php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26266 Concatenating overloaded objects causes crash
Submitted: 2003-11-15 15:08 UTC Modified: 2003-12-01 13:07 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: adam at trachtenberg dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-11-15 (dev) OS: Mac OS X 10.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adam at trachtenberg dot com
New email:
PHP Version: OS:

 

 [2003-11-15 15:08 UTC] adam at trachtenberg dot com
Description:
------------
Concatenating objects that define a __toString() method 
using the "." operator causes a bus error.

Reproduce code:
---------------
class foo {
    function __toString() {
        return "foo";
    }
}

$foo = new foo;
echo $foo . "\n";

Expected result:
----------------
foo

Actual result:
--------------
Bus error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-25 14:52 UTC] sniper@php.net
Doesn't crash with latest CVS.

 [2003-11-25 16:06 UTC] adam at trachtenberg dot com
Just updated to the latest CVS and it's still broken on 
my machine.

[adam@benlev:~/Documents/php/php5] $ php -v
PHP 5.0.0b3-dev (cli) (built: Nov 25 2003 15:56:32) 
(DEBUG)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend 
Technologies
 [2003-11-28 23:51 UTC] sniper@php.net
Nope doesn't crash with the provided example script (on linux)
No leaks, nothing. Can you provide a GDB backtrace of the crash?

 [2003-11-29 12:20 UTC] adam at trachtenberg dot com
This is what I get from gdb:

Core was generated by `/Users/adam/CVS/php/php-src/sapi/
cli/php'.
#0  0x0022e2c4 in ns_default.2 ()
(gdb) bt
#0  0x0022e2c4 in ns_default.2 ()
#1  0x0022e214 in ns_default.2 ()
#2  0x0022a4dc in ns_default.2 ()
#3  0x00260b3c in zend_concat_handler 
(execute_data=0x22a4dc, op_array=0x26d35c) at /Users/
adam/CVS/php/php-src/Zend/zend_execute.c:1359
#4  0x0026020c in execute (op_array=0xb11750) at /Users/
adam/CVS/php/php-src/Zend/zend_execute.c:1269
#5  0x00231300 in ns_default.2 ()
#6  0x001d4f20 in ns_default.2 ()
#7  0x00273124 in main (argc=2353640, argv=0xe) at /
Users/adam/CVS/php/php-src/sapi/cli/php_cli.c:910
 [2003-12-01 11:48 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Oops..misclicked the quickfix.. :) Of course I meant the PHP 5 snapshot.. :)

 [2003-12-01 13:07 UTC] adam at trachtenberg dot com
That works. Something much be messy with my CVS. Sorry.

I was wondering about the PHP 4 snap, but you did say 
"Yes, really, use the snapshot," so I followed along. :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 20:01:32 2025 UTC