php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: francois at tekwire dot net
New email:
PHP Version: OS:

 

 [2006-12-20 14:36 UTC] francois at tekwire dot net
Description:
------------
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 :

<?php
include 'b.php';
include 'c.php';

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

<?php
echo __FILE__."\n";
__halt_compiler();
data

* Run a.php

Expected result:
----------------
/depot/divers/flp/tmp/b.php
/depot/divers/flp/tmp/c.php


Actual result:
--------------
/depot/divers/flp/tmp/b.php

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 16:31 UTC] tony2001@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

A more meaningful error message added.
 [2007-02-07 06:29 UTC] cellog@php.net
A better fix for this bug is in:

http://news.php.net/php.internals/27872
 [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: Thu Nov 21 13:01:29 2024 UTC