php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #85 $php_errormsg isn't working
Submitted: 1998-02-19 13:46 UTC Modified: 1998-02-22 22:11 UTC
From: Brian dot Craigie at necs dot demon dot co dot uk Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Latest CVS OS: Solaris 2.5
Private report: No CVE-ID: None
 [1998-02-19 13:46 UTC] Brian dot Craigie at necs dot demon dot co dot uk
Hi.

I've got the following in php3.ini :-

track_errors=1             ; Store the last error/warning message in $php_errmsg (boolean)


1) Note the typo in the comment above - the $php_errmsg variable name is wrong.(from php3-dist.ini)

2) I am sure my Apache 1.3a1 httpd is looking at php3.ini because I trussed it, and can see a successfull open of the correct file.

When I try to access the variable (after forcing a mysql_connect failure), I get:

Warning: Using uninitialized variable $php_errormsg in /myfile.php3 on line 77

Yet in main.c, this is the variable name which is defined.

Curiously, that variable is only in main.c so I don't see how it can get set at all.  Anything I can do to get it working?

This is my code snippet (passwords removed):

dbh=mysql_connect("somehost","someuser","wrongpassword");
if (!$dbh) { echo "$php_errormsg<P>\n"; exit; }

And the message
Warning: MySQL: Unable to connect to server: Access denied for user:...
is displayed, yet not set into $php_errormsg.

Adding the @ before mysql_connect silences the warning, but it's still not set into $php_errormsg

I'd like to get this working so I can email myself these errors when they occur [meaningless to my users, but meaningful to me...]

Thanks!

Brian


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-22 22:11 UTC] jim
The problem was that $php_errormsg was a global variable,
and not in the local function scope.
Starting beta 5, $php_errormsg will be local to the function

In PHP 3.1, it'll be a 'true' global variable.

(The explanation is from Zeev, he just forgot to change the status to closed. -- Jim)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC