|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #5050 $php_errormsg not changed on errors inside functions
Submitted: 2000-06-15 05:16 UTC Modified: 2007-01-07 10:50 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: sp at alkor dot ru Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.0 Release OS: FreeBSD 4.0-R/3.x-R
Private report: No CVE-ID: None
 [2000-06-15 05:16 UTC] sp at alkor dot ru
# in apache.conf: php_value track_errors on
# This problem seems exists in PHP 3.0.x too.
function boo($tag) {
  global $php_errormsg;
  echo("$tag: $php_errormsg<br><br>\n");
function bar() {
  $x = @fopen("file-no-such", "r", 0);
  if(!$x) boo("BAR");
$php_errormsg = "Croak!";
$foo = @fopen("no-such-file", "r", 0);
if(!$foo) boo("MAIN");
$php_errormsg = "Croak!"; bar();
# Request: is it possible make something like
# set_track_errors(bool) to change track_errors
# on fly.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-23 14:59 UTC] stas at cvs dot php dot net
The problem here is that  php_error_cb sets $php_errormsg in active symbol table (i.e., of calling function) and not in the global symbol table. I do not know why. Anybody does?
 [2000-08-04 18:00 UTC]
Andi says it is an intended behaviour, so reclassifying is as a feature request.
 [2007-01-07 10:50 UTC]
ini_set("track_errors", 1);
Or use error_get_last()
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 20:01:31 2024 UTC