date & set_error_handler problem (SOLVED)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
steven72
Forum Newbie
Posts: 3
Joined: Fri Jan 13, 2006 4:21 am

date & set_error_handler problem (SOLVED)

Post by steven72 »

Hi,

I'm a beginner with PHP and I'm stucked in this problem:

Code: Select all

<?php

     set_error_handler('my_e_handler');

     function my_e_handler() {
          echo "error";
          exit();
     }

     $my_date = date('Y');
     echo $my_date;

?>
Why this prints "error" and not 2006??? A bug???

I have Windows XP, PHP 5.1.1 and Apache 2.0.55. I can't find any error/notice/warning messages in logs.

Plz let me know the answer!
Last edited by steven72 on Fri Jan 13, 2006 10:13 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

check to see what's being passed to the function..

debug_backtrace()

set_error_handler() :: handler ( int errno, string errstr [, string errfile [, int errline [, array errcontext]]] )
steven72
Forum Newbie
Posts: 3
Joined: Fri Jan 13, 2006 4:21 am

Post by steven72 »

Thanks mate! Problem solved. I used debug_backtrace() and noticed an error message. I haven't set a default timezone in php.ini, so the error_handler triggered because of that. Many thanks! :D
Post Reply