|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24729 $obj = new $className; causes crash when $className is not set
Submitted: 2003-07-20 14:58 UTC Modified: 2003-07-20 15:46 UTC
From: proton at fangen dot net Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-07-20 (dev) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: proton at fangen dot net
New email:
PHP Version: OS:


 [2003-07-20 14:58 UTC] proton at fangen dot net
Apache 2.0 / PHP 5-cvs crashes on Windows XP when trying to execute the following code if $className is not defined before it is used:

Reproduce code:
$c = new $className('whatever');

Expected result:
Fatal Error: Class '' was not found, or something like that


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-20 15:21 UTC]
Reproduced, this is the backtrace (the error message IS shown first though):

#0  0x08280b67 in zend_str_tolower_copy (
---Type <return> to continue, or q <return> to quit---
    dest=0x84351ec "Z\204?\217*?\217*ZZZZZZZZA", source=0x0, length=0)
    at /dat/dev/php/php-5.0.0dev/Zend/zend_operators.c:1655
1655		*result = *end;
(gdb) bt
#0  0x08280b67 in zend_str_tolower_copy (
    dest=0x84351ec "Z\204?\217*?\217*ZZZZZZZZA", source=0x0, length=0)
    at /dat/dev/php/php-5.0.0dev/Zend/zend_operators.c:1655
#1  0x082a4d1f in zend_str_tolower_dup (source=0x0, length=0)
    at /dat/dev/php/php-5.0.0dev/Zend/zend_operators.h:206
#2  0x0829ff9f in zend_fetch_class_handler (execute_data=0xbfffd0e0, 
    op_array=0x842f80c) at /dat/dev/php/php-5.0.0dev/Zend/zend_execute.c:2374
#3  0x0829c66a in execute (op_array=0x842f80c)
    at /dat/dev/php/php-5.0.0dev/Zend/zend_execute.c:1252
#4  0x408166d2 in xdebug_execute (op_array=0x842f80c)
    at /dat/dev/php/xdebug/xdebug.c:766
#5  0x0828382b in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /dat/dev/php/php-5.0.0dev/Zend/zend.c:1017
#6  0x08249b2c in php_execute_script (primary_file=0xbffff930)
    at /dat/dev/php/php-5.0.0dev/main/main.c:1695
#7  0x082aeea8 in main (argc=1, argv=0xbffff9d4)
    at /dat/dev/php/php-5.0.0dev/sapi/cli/php_cli.c:910
#8  0x406b4306 in __libc_start_main (main=0x82ae368 <main>, argc=1, 
    ubp_av=0xbffff9d4, init=0x808663c <_init>, fini=0x82afb10 <_fini>, 
    rtld_fini=0x4000d2dc <_dl_fini>, stack_end=0xbffff9cc)
    at ../sysdeps/generic/libc-start.c:129

 [2003-07-20 15:46 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 21 08:01:23 2020 UTC