php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69069 Unable to load class in output buffer handler after parse error
Submitted: 2015-02-18 05:10 UTC Modified: 2021-08-27 15:54 UTC
From: david at grudl dot com Assigned: cmb (profile)
Status: Closed Package: Output Control
PHP Version: 5.6.5 OS:
Private report: No CVE-ID: None
 [2015-02-18 05:10 UTC] david at grudl dot com
Description:
------------
This buf affects PHP 5.5, 5.6, 7.

Tests script writes:
PHP Parse error:  syntax error, unexpected 'error' (T_STRING) in W:\Nette\DI\parse-error.php on line 3
PHP Fatal error:  Class 'Environment' not found in W:\Nette\DI\parse-error.php on line 3
PHP Fatal error:  Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0

Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0

Test script:
---------------
<?php

class Environment
{
	public static $var;

	public static function setup()
	{
		ob_start(function($s) {
			Environment::$var;
			return $s;
		}, 1);
	}
}

Environment::setup();
require 'parse-error.php';


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-18 05:13 UTC] david at grudl dot com
parse-error.php file is any file containing parse error.
 [2015-02-18 07:06 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2015-02-18 07:06 UTC] rasmus@php.net
I don't understand your bug description. You have your output_handler set to what?

Generally if we can't compile the script, then we can't execute it. If you have a parse-error in your Test script, then there will be nothing to execute.
 [2015-02-19 16:08 UTC] david at grudl dot com
-Status: Feedback +Status: Open
 [2015-02-19 16:08 UTC] david at grudl dot com
Parse error (in other file) generates and sends to output buffer string "PHP Parse error:  syntax error etc. etc" and output buffer handler is unable to find class Environment (although is inside this class) and sends to output next error "PHP Fatal error:  Class 'Environment' not found".
 [2021-08-25 15:48 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-25 15:48 UTC] cmb@php.net
I cannot reproduce this with PHP-7.4.  Is this still an issue with
any of the actively supported PHP versions[1] for you?

[1] <https://www.php.net/supported-versions.php>
 [2021-08-27 15:51 UTC] david at grudl dot com
-Status: Feedback +Status: Closed
 [2021-08-27 15:51 UTC] david at grudl dot com
I can't reproduce it anymore either.
 [2021-08-27 15:54 UTC] cmb@php.net
Thanks for the swift confirmation!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 08:01:27 2024 UTC