473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems with error_reporting() in PHP5?

Greetings everyone!

I'm porting my applications to PHP5 and I've stumbled on yet another
problem. I'll try to simplify things a bit. I have a main script that
is being executed (index.php, PHP5 script) and that is including 2
other files: config.inc (PHP5 script, for the configuration) and
adodb.inc.php (PHP4 script, ADOdb functionality, though it could be
any other PHP4 script). On php.ini, error_reporting = E_ALL|E_STRICT.
These are the contents of the files:

- index.php:
<?php
include('config.inc');
include('adodb.inc.php');
?>

- config.inc:
<?php
error_reporting(E_ALL|E_STRICT);
?>

- adodb.inc.php:
<?php
error_reporting(E_ALL & ~E_STRICT);
// Following is the rest of the script with PHP4 things like:
class whatever {
var x;
......
}
?>

Now, what I was expecting was to have E_ALL and E_STRICT turned on
(because config.inc is included) and then, when parsing adodb.inc.php,
only E_ALL would be active. After adodb.inc.php is parsed, normal
behaviour set before by config.inc (i.e. E_ALL|E_STRICT) would be
resumed again.

But alas, this is not happening. The error_reporting() that I added to
the beginning of adodb.inc.php is not doing anything, since I keep
getting Strict Standards warnings in the adodb.inc.php file, saying
among other things that var is deprecated...

I'd like to have my new PHP5 application to have all the E_STRICT
warnings turned on, only turning them off for specific third party
scripts that are not completely compatible with that directive...

Is this a little bug with the error_reporting() in PHP5? Or what is
the problem?
Jul 17 '05 #1
1 3516
OK, for the sake of this knownledge on usenet, I'll post the solution
to my own problem, that in the meantime I got to solve.

So, instead of the original code I had, the correct code is:

- index.php:
<?php
include('config.inc');
// Begin 3rd party library inclusion
$old = error_reporting(E_ALL & ~E_STRICT);
include('adodb.inc.php');
error_reporting($old);
// End 3rd party library inclusion
?>

- config.inc:
<?php
// NO LONGER NECESSARY:
// error_reporting(E_ALL|E_STRICT);
?>

- adodb.inc.php:
<?php
// NO LONGER NECESSARY:
// error_reporting(E_ALL & ~E_STRICT);
// Following is the rest of the script with PHP4 things like:
class whatever {
var x;
......
}
?>

Thank me. :-)
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Antoine Bloncourt | last post by:
Hello everybody Sorry to bother you but I have a problem writing datas into a file ... I want to make a backup of my MySQL database and put the result into a ..sql file. To do this, I use...
7
by: zYm3N | last post by:
Hi ! It's my first post here: Hello everyone :-) Do you know why this code doesnt work ? Thanks for any help. <? echo('start<br>'); // redefine the user error constants - PHP 4 only...
6
by: Ask Josephsen | last post by:
Hi NG If I write the following: <?php $file="myfile.JPG"; if ( getmyuid()==fileowner ( $file ) ) { chgrp ( $file, getmygid() ); chown ( $file, getmyuid() );
4
by: Mxsmanic | last post by:
The require() I'm using in a PHP script has stopped working after I moved from PHP4 and Apache 1.3.x to PHP5 and Apache 2.x. Now I get messages like this: Warning:...
0
by: Philipp Lenssen | last post by:
I have Windows XP with PHP5 installed. In the PHP5.ini it reads (not commented): extension=php_gd2.dll The extension path is right as well. Now I have an Apache running. However dumping...
19
by: McKirahan | last post by:
I am working in two environments neither configuration of which I can change; one's my Web host the other a client. My Web host requires the use of the ".php5" extension to use PHP v5.1.4; where...
3
by: Matthias Leopold | last post by:
hi i've got problems getting php4 scripts which use curl to work on RHEL4 (Nahant Update 4) and CentOS 4.4. when the script is accessed the browser "hangs", after a couple of minutes i'm...
5
by: dipperdan | last post by:
Hi, I'm trying to use sessions to create a login system to administer a website - add new info to database,etc but i'm running into some problems. The first page login.php seems to work okay, it...
6
by: msb_6 | last post by:
Currently I have a PHP extension thats all written and compiles under windows, but the PC I'm going to end up putting it on is running Ubuntu 8.04 (g++ 4.2.3). I've delved into PHP documentation...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.