php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49387 E_DEPRECATED looks like a fatal error, even off
Submitted: 2009-08-27 12:53 UTC Modified: 2011-02-28 18:25 UTC
From: fernando dot wendt at gmail dot com Assigned: rasmus (profile)
Status: Closed Package: *Configuration Issues
PHP Version: 5.3.0 OS: Windows XP
Private report: No CVE-ID: None
 [2009-08-27 12:53 UTC] fernando dot wendt at gmail dot com
Description:
------------
PHP is ignoring the php.ini error_reporting configuration, and is always hangin up scripts with the E_DEPRACATED message.

The default error_reporting = E_ALL & ~E_DEPRACATED is not working. All depracated warnings are working as fatal errors, and i believe that was not the intention it supposed to do.

The only way to avoid this (at least on my workaround) is setting up the display_errors = Off (even on my workstation).



Reproduce code:
---------------
Try some script that have depracated function or issue to work. It will freeze as a fatal error, pointing a depracated message.

Expected result:
----------------
First, it should respect the php.ini ~E_DEPRECATED flag and then show deprecated issues as warnings, not as fatal errors.

Actual result:
--------------
php.ini ~E_DEPRECATED is not working: his behavior looks like a fatal error, and is not being respected if is on or off.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-27 16:17 UTC] sjoerd@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-08-27 19:02 UTC] fernando dot wendt at gmail dot com
Ops!

Trying to reproduce it twice, it points me to be working fine :)

Trully, there is a incomplete behavior present at phpPgAdmin (method "printHeader", that have junt one "if" trying to change document header. That was why the script seems to be stoping anyway.

Sorry, its all right. Bellows, a little buggy script to confirm this.

<?php

	class Doit{
	  private $foo;
	  
	  public function __construct(){
	    $this->foo = 'Something';	  
	  }
	  
	  public function getfoo(){
		  return($this->foo);
	  }	
	}
	
	$data =& new Doit(); //Deprecated issue
	echo $data->getfoo;
	
	$xpto = 12; //Logical follows
	echo $xpto;
	
	pg_connect();//Missing function data

?>
 [2011-02-28 18:15 UTC] thorn at thorn dot ch
I've the same problem.

I upgraded to PHP Version 5.3.3-7 (Debian/Squeeze stable) and got now those error messages about the DEPRECATED use of function "ereg_replace"

Following php.ini entries does NOT work to disable the DEPRECATED message:
error_reporting  =  E_ALL & ~E_NOTICE & ~E_DEPRECATED
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR|E_CORE_WARNING

Now I had disabled the output:
display_errors = Off

But the logs will be overfilled as long the deprecated functions are in use... :-(
 [2011-02-28 18:25 UTC] rasmus@php.net
-Assigned To: +Assigned To: rasmus
 [2011-02-28 18:25 UTC] rasmus@php.net
Works fine here:

<?php
error_reporting(-1);
echo ereg_replace('abc','abc','123');
error_reporting(0);
echo ereg_replace('abc','abc','456');

Outputs:

PHP Deprecated:  Function ereg_replace() is deprecated in 
/home/sites/wepay.com/current/u on line 3

Deprecated: Function ereg_replace() is deprecated in 
/home/sites/wepay.com/current/u on line 3
123456

That is, there is only a deprecated warning printed for line 3, nothing for line 
5.
 [2011-10-27 06:06 UTC] locutus1701e at gmail dot com
I met same problem.
It caused by "allow_call_time_pass_reference = Off" in php.ini file.

The error is 
"FATAL [/foo/bar.php:54] Call-time pass-by-reference has been deprecated"

This error message is misleading. 
It is not "deprecated". It is "not allowed."

I think the message should be change ,such as
 ~ is not allowed. If you want to allow it , set "allow_call_time_pass_reference = On".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 21:01:32 2024 UTC