|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58523 __halt_compiler() support does not correctly cache
Submitted: 2009-01-27 20:00 UTC Modified: 2009-02-05 08:18 UTC
From: Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.5 OS: CentOS 5
Private report: No CVE-ID: None
 [2009-01-27 20:00 UTC]
related to issue #7209. The first run of a page using __halt_compiler() works correctly, however any following executions of the page act as though the __halt_compiler() was not set and the notice

PHP Notice:  Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' 

is generated.

I have tested this on stock PHP 5.1.6 and APC 3.0.19 as well as  PHP 5.2.6 and ACP 3.0.19 as well as PHP 5.2.6 w/ APC 3.1.2.

Reproduce code:
$fp = fopen(__FILE__, 'r');
fseek($fp, __COMPILER_HALT_OFFSET__);
echo stream_get_contents($fp);
This is some sample text appended to the end of a php script

ie.. it could be Wiki text and then run it though the PEAR Text_Wiki class:) neat eh?

Expected result:
ever run to output the text at the end of the file.

Actual result:
a PHP notice is generated and the entire contents of the PHP script is output (as the constant is coerced to "0")


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-05 07:40 UTC] gopalv82 at yahoo dot com
Annoying, __halt_compiler() is handled in the language parser with zend_do_halt_compiler_register.

Since we don't recompile the file, the file never passes through the parser. There is no opcode for that function at all.

Guess that means I'll have to fake it with a check for the corresponding mangled constant.

In other news, this is a very inefficient way to actually 
store plain text because it requires an actual open() call
which APC manages to avoid otherwise.
 [2009-02-05 08:17 UTC] gopalv82 at yahoo dot com

Should be fixed now, please test the CVS HEAD please.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 16:05:49 2023 UTC