|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39903 Notice message when executing __halt_compiler() more than once
Submitted: 2006-12-20 14:36 UTC Modified: 2007-05-24 16:04 UTC
From: francois at tekwire dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.0 OS: All
Private report: No CVE-ID: None
 [2006-12-20 14:36 UTC] francois at tekwire dot net
When __halt_compiler() is seen for the second time, PHP displays a message saying:

Notice: Constant __COMPILER_HALT_OFFSET__ already defined in ...

Although it cannot happen in a single file, it can happen when including two files containing an __halt_compiler() directive.

The constant should be undefined before calling REGISTER_MAIN_LONG_CONSTANT("__C
OMPILER_HALT_OFFSET__", zend_get_scanned_file_offset(TSRMLS_C), CONST_CS) in zend_language_parser.y but I haven't found any function  to undefine a constant...

Reproduce code:
* File a.php contains :

include 'b.php';
include 'c.php';

* File b.php and c.php both contain :

echo __FILE__."\n";

* Run a.php

Expected result:

Actual result:

Notice: Constant __COMPILER_HALT_OFFSET__ already defined in /depot/divers/flp/tmp/c.php on line 3


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 16:31 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

A more meaningful error message added.
 [2007-02-07 06:29 UTC]
A better fix for this bug is in:
 [2007-05-24 16:04 UTC] francois at tekwire dot net
For the ones interested, the issue was fixed by Greg's patch in 5.2.2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 09:01:28 2024 UTC