This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 180019 - set_error_handler function called from within debugger -out of context
Summary: set_error_handler function called from within debugger -out of context
Status: RESOLVED INCOMPLETE
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-30 06:23 UTC by madtom
Modified: 2011-09-21 15:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description madtom 2010-01-30 06:23:36 UTC
I have a web app with a function set with set_error_handler to email me errors.
This appears to be called from within the debugger where it complains of not finding the error_recipient which it then sends the mail to.
The following is the data from the mail it sends.

Error Occured @
Error Level 8 
Error Message Undefined variable: error_recipient 
In. file xdebug eval 
At line 1 
Context:Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_ENV] => Array
        (
            [APACHE_PID_FILE] => /var/run/apache2.pid
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [LANG] => C
            [APACHE_RUN_GROUP] => www-data
            [APACHE_RUN_USER] => www-data
            [PWD] => /
        )

    [HTTP_ENV_VARS] => Array
        (
            [APACHE_PID_FILE] => /var/run/apache2.pid
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [LANG] => C
            [APACHE_RUN_GROUP] => www-data
            [APACHE_RUN_USER] => www-data
            [PWD] => /
        )

    [_POST] => Array
        (
        )

    [HTTP_POST_VARS] => Array
        (
        )

    [_GET] => Array
        (
        )

    [HTTP_GET_VARS] => Array
        (
        )

    [_COOKIE] => Array
        (
            [PHPSESSID] => 00fccf820727e1e1612598ebdc639496
            [XDEBUG_SESSION] => netbeans-xdebug
        )

    [HTTP_COOKIE_VARS] => Array
        (
            [PHPSESSID] => 00fccf820727e1e1612598ebdc639496
            [XDEBUG_SESSION] => netbeans-xdebug
        )

    [_SERVER] => Array
        (
            [HTTP_HOST] => localhost
            [HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5
            [HTTP_ACCEPT_ENCODING] => gzip,deflate
            [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
            [HTTP_KEEP_ALIVE] => 300
            [HTTP_CONNECTION] => keep-alive
            [HTTP_REFERER] => http://localhost/~tom/play1/Test.php
            [HTTP_COOKIE] => PHPSESSID=00fccf820727e1e1612598ebdc639496; XDEBUG_SESSION=netbeans-xdebug
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] => <address>Apache/2.2.12 (Ubuntu) Server at localhost Port 80</address>

            [SERVER_SOFTWARE] => Apache/2.2.12 (Ubuntu)
            [SERVER_NAME] => localhost
            [SERVER_ADDR] => 127.0.0.1
            [SERVER_PORT] => 80
            [REMOTE_ADDR] => 127.0.0.1
            [DOCUMENT_ROOT] => /var/www
            [SERVER_ADMIN] => webmaster@localhost
            [SCRIPT_FILENAME] => /home/tom/public_html/play1/GetAddress.php
            [REMOTE_PORT] => 35015
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_PROTOCOL] => HTTP/1.1
            [REQUEST_METHOD] => GET
            [QUERY_STRING] => 
            [REQUEST_URI] => /~tom/play1/GetAddress.php
            [SCRIPT_NAME] => /~tom/play1/GetAddress.php
            [PHP_SELF] => /~tom/play1/GetAddress.php
            [REQUEST_TIME] => 1264787749
            [argv] => Array
                (
                )

            [argc] => 0
        )

    [HTTP_SERVER_VARS] => Array
        (
            [HTTP_HOST] => localhost
            [HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5
            [HTTP_ACCEPT_ENCODING] => gzip,deflate
            [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
            [HTTP_KEEP_ALIVE] => 300
            [HTTP_CONNECTION] => keep-alive
            [HTTP_REFERER] => http://localhost/~tom/play1/Test.php
            [HTTP_COOKIE] => PHPSESSID=00fccf820727e1e1612598ebdc639496; XDEBUG_SESSION=netbeans-xdebug
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] => <address>Apache/2.2.12 (Ubuntu) Server at localhost Port 80</address>

            [SERVER_SOFTWARE] => Apache/2.2.12 (Ubuntu)
            [SERVER_NAME] => localhost
            [SERVER_ADDR] => 127.0.0.1
            [SERVER_PORT] => 80
            [REMOTE_ADDR] => 127.0.0.1
            [DOCUMENT_ROOT] => /var/www
            [SERVER_ADMIN] => webmaster@localhost
            [SCRIPT_FILENAME] => /home/tom/public_html/play1/GetAddress.php
            [REMOTE_PORT] => 35015
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_PROTOCOL] => HTTP/1.1
            [REQUEST_METHOD] => GET
            [QUERY_STRING] => 
            [REQUEST_URI] => /~tom/play1/GetAddress.php
            [SCRIPT_NAME] => /~tom/play1/GetAddress.php
            [PHP_SELF] => /~tom/play1/GetAddress.php
            [REQUEST_TIME] => 1264787749
            [argv] => Array
                (
                )

            [argc] => 0
        )

    [_FILES] => Array
        (
        )

    [HTTP_POST_FILES] => Array
        (
        )

    [_REQUEST] => Array
        (
            [PHPSESSID] => 00fccf820727e1e1612598ebdc639496
            [XDEBUG_SESSION] => netbeans-xdebug
        )

    [HTTP_SESSION_VARS] => Array
        (
            [site_root] => /play1/
            [debug_level] => 1
            [application_root] => /play1/
            [dbuser] => webuser
            [dbpassword] => webuser
            [dbconn] => localhost
            [dbdb] => shop
            [status] => started
            [order_id] => 79
        )

    [_SESSION] => Array
        (
            [site_root] => /play1/
            [debug_level] => 1
            [application_root] => /play1/
            [dbuser] => webuser
            [dbpassword] => webuser
            [dbconn] => localhost
            [dbdb] => shop
            [status] => started
            [order_id] => 79
        )

    [site_root] => /play1/
    [username] => 
    [debug_level] => 1
    [application_root] => /play1/
    [default_page] => catalogue.php
    [order_id] => 79
    [thispage] => GetAddress.php
    [order] => Order Object
        (
            [id] => 79
            [status] => 1
            [owner] => Person Object
                (
                    [id] => 41
                    [name] => d.
                    [surname] => eathlydddd
                    [title] => Salutation Object
                        (
                            [index] => 2
                            [salutation] => Dr
                        )

                    [phone] => 2323
                    [mobile] => r42523
                    [email] => email@mailcom
                    [contact] => 1
                )

            [address] => Address Object
                (
                    [index] => 72
                    [address1] => addr1
                    [address2] => addr2
                    [address3] => addr3
                    [address4] => addr4
                    [postcode] => ip4 2qu
                )

            [delivery] => Address Object
                (
                    [index] => 72
                    [address1] => addr1
                    [address2] => addr2
                    [address3] => addr3
                    [address4] => addr4
                    [postcode] => ip4 2qu
                )

            [shareaddress] => 1
            [orderDetails] => OrderDetails Object
                (
                    [orderDetails] => Array
                        (
                            [0] => OrderLine Object
                                (
                                    [id] => 1
                                    [name] => Rabbit Offal
                                    [description] => Horrible Bits of Guts
                                    [qty] => 8
                                    [price] => 24
                                    [tot] => 192
                                )

                            [1] => OrderLine Object
                                (
                                    [id] => 3
                                    [name] => Big Table
                                    [description] => A big Table
                                    [qty] => 3
                                    [price] => 240
                                    [tot] => 720
                                )

                        )

                    [lineCount] => 2
                )

        )

    [referer] => http://localhost/~tom/play1/Test.php
    [bits] => Array
        (
            [scheme] => http
            [host] => localhost
            [path] => /~tom/play1/Test.php
        )

    [path] => /~tom/play1/Test.php
    [callingpage] => Test.php
    [sal] => Salutation Object
        (
            [index] => 0
            [salutation] => 
        )

)
Comment 1 rmatous 2010-02-22 08:47:54 UTC
Can you attach sample to better understand where the problem is because else cannot be fixed. Thanks for helping in advance.
Comment 2 madtom 2010-02-22 15:35:55 UTC
(In reply to comment #1)
> Can you attach sample to better understand where the problem is because else
> cannot be fixed. Thanks for helping in advance.


The above listing is a context dump by MY error handler which lists as much as it can
----------
function error_fun($error_level,$error_message,$error_file,$error_line,$error_context){

  $error_recipient='fmaster@localhost';

  $message="Error Occured @\n";
  $message=$message."Error Level $error_level \n";
  $message=$message."Error Message $error_message \n";
  $message=$message."In. file $error_file \n";
  $message=$message."At line $error_line \n";
  $message=$message."Context:".print_r($error_context,true)." \n";

  $headers="From: website@localhost" . "\r\n";
  mail($error_recipient, 'errorhappened', $message,$headers);
  //echo "mail sent";
 }
 set_error_handler("error_fun");
----------
The start of the mail sent to fmaster@localhost (full listing in previous post) is:
------------- 
Error Occured @
Error Level 8 
Error Message Undefined variable: error_recipient 
In. file xdebug eval 
-------------
This suggest to me that an error is occurring in xdebug eval that is calling the above error function, causing further errors as it is out of true context 
which then trigger the error to be somehow called properly so that it then send me the above.
When running outside of the debugger I get no errors sent, under the debugger I get a number of these messages sent - the number seems to be roughly proportional to the time spent stepping through the code.
Try it - you'll love it!
Tom
Comment 3 Filip Zamboj 2010-02-22 16:41:29 UTC
would you try with new version of xdebug (check it out) and new version of netbeans that you can download from http://bertram.netbeans.org/hudson/job/PHP-build/

thanks a lot!
Comment 4 Filip Zamboj 2010-09-15 12:30:45 UTC
batch reassigning
Comment 5 Tomas Mysik 2011-06-03 10:18:33 UTC
Batch reassigning.
Comment 6 Tomas Mysik 2011-06-09 13:20:39 UTC
Reassigning to the module owner.
Comment 7 Ondrej Brejla 2011-09-21 14:15:55 UTC
We made some fixes with eval in NB 7.1dev, please, can you test it in NB 7.1 development version? Thanks.
Comment 8 madtom 2011-09-21 15:10:11 UTC
Unable to test at moment. Will try and process soon.