Bug #74032 [Opn->Nab]: The code should throw a DEPRECATED message and it doesn't
| From: | cmb@php.net | Date: | Thu, 02 Feb 2017 17:59:13 +0000 |
| Subject: | Bug #74032 [Opn->Nab]: The code should throw a DEPRECATED message and it doesn't | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207133@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74032&edit=1
ID: 74032
Updated by: cmb@php.net
Reported by: roma dot chikunov at gmail dot com
Summary: The code should throw a DEPRECATED message and it
doesn't
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Xubuntu
PHP Version: 7.0.15
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> Question is - why it doesn't work without eval?
As nikic has explained, error_reporting() and ini_set() can't
catch compile time errors. Set the appropriate directives in
php.ini during development.
Previous Comments:
------------------------------------------------------------------------
[2017-02-02 13:07:49] roma dot chikunov at gmail dot com
eval() worked!
Question is - why it doesn't work without eval? Obviously, no developer will insert their
classes into eval to check for a deprecated error.
------------------------------------------------------------------------
[2017-02-02 12:58:30] nikic@php.net
This deprecation is generated at compile-time, while error_reporting() and ini_set() are called at
run-time. Try wrapping the class declaration in an eval() to see if that's the issue.
------------------------------------------------------------------------
[2017-02-02 12:46:31] roma dot chikunov at gmail dot com
Thanks for the prompt response!
I am logging to to the default apache error.log file.
As far as I know, error_reporting(-1) should log everything.
Just out of curiosity I have checked other deprecated stuff and it worked for me (specifically
options in password_hash()), hence I don't think there's an issue with the logging.
Anyhow, I have also added ini_set('display_errors', '1'); to the code and
there's no difference.
------------------------------------------------------------------------
[2017-02-02 12:34:19] requinix@php.net
Works for me. https://3v4l.org/p0K0l
Do you have display_errors on? Maybe you're logging errors to a file?
------------------------------------------------------------------------
[2017-02-02 12:23:36] roma dot chikunov at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/migration70.deprecated
---
In the manual page it is written that PHP 4 constructor is deprecated, therefore an error should be
logged of PHP DEPRECATED, unfortunately it doesn't happen.
The sample code is taken as is (except for the error_reporting method) from the documentation.
Test script:
---------------
<?php
error_reporting(-1);
class foo {
function foo() {
echo 'I am the constructor';
}
}
$obj = new foo();
?>
Expected result:
----------------
The expected result is for an error to be logged for using a deprecated constructor.
Actual result:
--------------
Works like a charm without any error \ warning
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74032&edit=1