php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36528 parse error not displayed under E_STRICT
Submitted: 2006-02-25 17:29 UTC Modified: 2006-02-25 17:36 UTC
From: arachnion at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID: None
 [2006-02-25 17:29 UTC] arachnion at gmail dot com
Description:
------------
If I put "global $var;" in an included class definition, the parse error is not raised under "error_reporting( E_STRICT );".

Reproduce code:
---------------
//main.php
<?php
error_reporting( E_ALL & E_STRICT );
$var = null;
include 'inc.php';
echo 'debug!';

//inc.php
<?php
class User
{
  global $var;
}

Expected result:
----------------
Parse error: parse error, unexpected T_GLOBAL, expecting T_FUNCTION in C:\Program Files\xampp\htdocs\memoria\phpbug\inc.php on line 4

Actual result:
--------------
<nothing>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-25 17:36 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You are trying to set the error reporting in your script. Code is executed *after* the whole file is parsed. Your statement will therefore have no effect on the parsing stage. You will see an error if you set E_STRICT in your php.ini.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 02:00:03 2025 UTC