Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18657 > unrolled thread

set_error_handler(): duplicate error

Started byalex <1j9448a02@lnx159sneakemail.com.invalid>
First post2021-06-10 11:04 +0200
Last post2021-06-23 10:24 +0200
Articles 16 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-10 11:04 +0200
    Re: set_error_handler(): duplicate error Ii Ii <ya12983@mail.com> - 2021-06-16 02:39 -0700
    Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-16 13:48 +0200
      Re: set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-18 14:53 +0200
        Re: set_error_handler(): duplicate error Jerry Stuckle <jstucklex@attglobal.net> - 2021-06-18 22:00 -0400
          Re: set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-19 16:41 +0200
            Re: set_error_handler(): duplicate error Jerry Stuckle <jstucklex@attglobal.net> - 2021-06-19 19:21 -0400
              Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-20 13:10 +0200
          Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-20 13:02 +0200
        Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-20 12:51 +0200
          Re: set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-21 17:06 +0200
            Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-21 19:43 +0200
              Re: set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-22 16:10 +0200
                Re: set_error_handler(): duplicate error "J.O. Aho" <user@example.net> - 2021-06-22 18:13 +0200
                  Re: set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-23 13:35 +0200
                Re: set_error_handler(): duplicate error Arno Welzel <usenet@arnowelzel.de> - 2021-06-23 10:24 +0200

#18657 — set_error_handler(): duplicate error

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-10 11:04 +0200
Subjectset_error_handler(): duplicate error
Message-ID<s9ski4$42b$2@gioia.aioe.org>
<?php
//error_reporting(0);
set_error_handler(
     static function (int $severity, string $message, string $file, int 
$line): void {
         throw new InternalErrorException($message, 0, $severity, $file, 
$line);
     }
);

xxx();

Output:

Fatal error: Uncaught Error: Call to undefined function xxx() in 
/tmp/tmp.Ie1UVhkWcT/test.php on line 9

Error: Call to undefined function xxx() in /tmp/tmp.Ie1UVhkWcT/test.php 
on line 9

Call Stack:
     0.0001     392928   1. {main}() /tmp/tmp.Ie1UVhkWcT/test.php:0

Why error message showing is duplicate?
Furthermore, if uncommenting the error_reporting(0) instruction does not 
show any errors.
is there a good compromise?

[toc] | [next] | [standalone]


#18658

FromIi Ii <ya12983@mail.com>
Date2021-06-16 02:39 -0700
Message-ID<b10a8527-d102-4656-848c-e8acd16abfcan@googlegroups.com>
In reply to#18657
I have no idea, why it is like this.



alex kirjutas neljapäev, 10. juuni 2021 kl 12:04:11 UTC+3:
> <?php 
> //error_reporting(0); 
> set_error_handler( 
> static function (int $severity, string $message, string $file, int 
> $line): void { 
> throw new InternalErrorException($message, 0, $severity, $file, 
> $line); 
> } 
> ); 
> 
> xxx(); 
> 
> Output: 
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in 
> /tmp/tmp.Ie1UVhkWcT/test.php on line 9 
> 
> Error: Call to undefined function xxx() in /tmp/tmp.Ie1UVhkWcT/test.php 
> on line 9 
> 
> Call Stack: 
> 0.0001 392928 1. {main}() /tmp/tmp.Ie1UVhkWcT/test.php:0 
> 
> Why error message showing is duplicate? 
> Furthermore, if uncommenting the error_reporting(0) instruction does not 
> show any errors. 
> is there a good compromise?

[toc] | [prev] | [next] | [standalone]


#18659

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-16 13:48 +0200
Message-ID<iiu6nlForanU1@mid.individual.net>
In reply to#18657
alex:

> <?php
> //error_reporting(0);
> set_error_handler(
>      static function (int $severity, string $message, string $file, int 
> $line): void {
>          throw new InternalErrorException($message, 0, $severity, $file, 
> $line);
>      }
> );
> 
> xxx();
> 
> Output:
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in 
> /tmp/tmp.Ie1UVhkWcT/test.php on line 9
> 
> Error: Call to undefined function xxx() in /tmp/tmp.Ie1UVhkWcT/test.php 
> on line 9
> 
> Call Stack:
>      0.0001     392928   1. {main}() /tmp/tmp.Ie1UVhkWcT/test.php:0
> 
> Why error message showing is duplicate?

I can't reproduce this. When I run this script with PHP 7.4 as CLI, I
only get the expected result:

PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
D:\test-errorhandler.php:11
Stack trace:
#0 {main}
  thrown in D:\test-errorhandler.php on line 11

Do you run the above script within a larger application which already
has some kind of error handling in place?


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18660

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-18 14:53 +0200
Message-ID<sai4vp$11n3$1@gioia.aioe.org>
In reply to#18659
Il 16/06/21 13:48, Arno Welzel ha scritto:
> I can't reproduce this.

????

> When I run this script with PHP 7.4 as CLI, I
> only get the expected result:
> 
> PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
> D:\test-errorhandler.php:11
> Stack trace:
> #0 {main}
>    thrown in D:\test-errorhandler.php on line 11
> 
> Do you run the above script within a larger application which already
> has some kind of error handling in place?

No.

$ php -v
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
     with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
     with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
tmp.MLHFJ8krVq$ cat test.php
<?php
set_error_handler(
     static function (int $severity, string $message, string $file, int 
$line): void {
         throw new InternalErrorException($message, 0, $severity, $file, 
$line);
     }
);
xxx();
tmp.MLHFJ8krVq$ php test.php

Fatal error: Uncaught Error: Call to undefined function xxx() in 
/tmp/tmp.MLHFJ8krVq/test.php on line 7

Error: Call to undefined function xxx() in /tmp/tmp.MLHFJ8krVq/test.php 
on line 7

Call Stack:
     0.0001     394848   1. {main}() /tmp/tmp.MLHFJ8krVq/test.php:0

[toc] | [prev] | [next] | [standalone]


#18661

FromJerry Stuckle <jstucklex@attglobal.net>
Date2021-06-18 22:00 -0400
Message-ID<sajj55$jqj$1@jstuckle.eternal-september.org>
In reply to#18660
On 6/18/2021 8:53 AM, alex wrote:
> Il 16/06/21 13:48, Arno Welzel ha scritto:
>> I can't reproduce this.
> 
> ????
> 
>> When I run this script with PHP 7.4 as CLI, I
>> only get the expected result:
>>
>> PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
>> D:\test-errorhandler.php:11
>> Stack trace:
>> #0 {main}
>>    thrown in D:\test-errorhandler.php on line 11
>>
>> Do you run the above script within a larger application which already
>> has some kind of error handling in place?
> 
> No.
> 
> $ php -v
> PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
> Copyright (c) The PHP Group
> Zend Engine v3.4.0, Copyright (c) Zend Technologies
>      with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
>      with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
> tmp.MLHFJ8krVq$ cat test.php
> <?php
> set_error_handler(
>      static function (int $severity, string $message, string $file, int 
> $line): void {
>          throw new InternalErrorException($message, 0, $severity, $file, 
> $line);
>      }
> );
> xxx();
> tmp.MLHFJ8krVq$ php test.php
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in 
> /tmp/tmp.MLHFJ8krVq/test.php on line 7
> 
> Error: Call to undefined function xxx() in /tmp/tmp.MLHFJ8krVq/test.php 
> on line 7
> 
> Call Stack:
>      0.0001     394848   1. {main}() /tmp/tmp.MLHFJ8krVq/test.php:0
> 

set_error_handler() requires a real function as its parameter, not 
something dynamically defined.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#18662

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-19 16:41 +0200
Message-ID<sakvm9$168h$1@gioia.aioe.org>
In reply to#18661
Il 19/06/21 04:00, Jerry Stuckle ha scritto:
> 
> set_error_handler() requires a real function as its parameter, not 
> something dynamically defined.

class C {
     static function f($severity, $message) {
         throw new InternalErrorException($message);
     }
}

set_error_handler('C::f');

xxx();

Output

Fatal error: Uncaught Error: Call to undefined function xxx() in 
/tmp/tmp.F06vf0Q7H0/test.php on line 10

Error: Call to undefined function xxx() in /tmp/tmp.F06vf0Q7H0/test.php 
on line 10

Call Stack:
     0.0001     394552   1. {main}() /tmp/tmp.F06vf0Q7H0/test.php:0

[toc] | [prev] | [next] | [standalone]


#18663

FromJerry Stuckle <jstucklex@attglobal.net>
Date2021-06-19 19:21 -0400
Message-ID<salu6v$qr1$1@jstuckle.eternal-september.org>
In reply to#18662
On 6/19/2021 10:41 AM, alex wrote:
> Il 19/06/21 04:00, Jerry Stuckle ha scritto:
>>
>> set_error_handler() requires a real function as its parameter, not 
>> something dynamically defined.
> 
> class C {
>      static function f($severity, $message) {
>          throw new InternalErrorException($message);
>      }
> }
> 
> set_error_handler('C::f');
> 
> xxx();
> 
> Output
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in 
> /tmp/tmp.F06vf0Q7H0/test.php on line 10
> 
> Error: Call to undefined function xxx() in /tmp/tmp.F06vf0Q7H0/test.php 
> on line 10
> 
> Call Stack:
>      0.0001     394552   1. {main}() /tmp/tmp.F06vf0Q7H0/test.php:0
> 
> 

Normal operation.  See the restrictions under set_error_handler(), namely

"The following error types cannot be handled with a user defined 
function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, 
E_COMPILE_ERROR, E_COMPILE_WARNING independent of where they were 
raised, and most of E_STRICT raised in the file where 
set_error_handler() is called. "


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#18667

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-20 13:10 +0200
Message-ID<ij8m13Fpc2cU1@mid.individual.net>
In reply to#18663
Jerry Stuckle:

> On 6/19/2021 10:41 AM, alex wrote:
>> Il 19/06/21 04:00, Jerry Stuckle ha scritto:
>>>
>>> set_error_handler() requires a real function as its parameter, not 
>>> something dynamically defined.
>>
>> class C {
>>      static function f($severity, $message) {
>>          throw new InternalErrorException($message);
>>      }
>> }
>>
>> set_error_handler('C::f');
>>
>> xxx();
>>
>> Output
>>
>> Fatal error: Uncaught Error: Call to undefined function xxx() in 
>> /tmp/tmp.F06vf0Q7H0/test.php on line 10
>>
>> Error: Call to undefined function xxx() in /tmp/tmp.F06vf0Q7H0/test.php 
>> on line 10
>>
>> Call Stack:
>>      0.0001     394552   1. {main}() /tmp/tmp.F06vf0Q7H0/test.php:0
>>
>>
> 
> Normal operation.  See the restrictions under set_error_handler(), namely
> 
> "The following error types cannot be handled with a user defined 
> function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, 
> E_COMPILE_ERROR, E_COMPILE_WARNING independent of where they were 
> raised, and most of E_STRICT raised in the file where 
> set_error_handler() is called. "

Thanks for pointing this out.

Also see: <https://www.php.net/manual/en/function.set-error-handler.php>

This means, if such an error ocurrs - like calling an undefined function
- it will *not* be passed to the handler defined in set_error_handler().

So this works:

------------------------------

<?php
set_error_handler(
     function(
         int $severity,
         string $message,
         string $file,
         int $line
     ): void {
         throw new Exception('Error catched: '.$message);
     }
);

$a = 1/0;

------------------------------

But this *not*, because calling an undefined function will *not* be
passed to the user error handler:

<?php
set_error_handler(
     function(
         int $severity,
         string $message,
         string $file,
         int $line
     ): void {
         throw new Exception('Error catched: '.$message);
     }
);

xxx();


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18666

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-20 13:02 +0200
Message-ID<ij8ligFp9b6U1@mid.individual.net>
In reply to#18661
Jerry Stuckle:

[...]
> set_error_handler() requires a real function as its parameter, not 
> something dynamically defined.

set_error_handler() requires a *callable* not a function. An anonymous
function is just fine - as this *is* a callable. This applies to *every*
function in PHP which wants a callable and is quite handy to avoid
declaring new functions if you just need it once for a specific callback:

-------------------------------------------

<?php
$array = [
    [ 'x' => 1, 'y' => 2 ],
    [ 'x' => 6, 'y' => 1 ],
    [ 'x' => 3, 'y' => 7 ],
];

usort(
    $array,
    function($a, $b) {
        if ($a['x'] == $b['x']) {
            return 0;
        } else if ($a['x'] > $b['x']) {
            return 1;
        } else {
            return -1;
        }
    }
);

print_r($array);

-------------------------------------------

Result:

Array
(
    [0] => Array
        (
            [x] => 1
            [y] => 2
        )

    [1] => Array
        (
            [x] => 3
            [y] => 7
        )

    [2] => Array
        (
            [x] => 6
            [y] => 1
        )

)



-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18665

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-20 12:51 +0200
Message-ID<ij8kteFp5ocU1@mid.individual.net>
In reply to#18660
alex:

> Il 16/06/21 13:48, Arno Welzel ha scritto:
>> I can't reproduce this.
> 
> ????

When I run your script, I only get *one* error output, not two.

>> When I run this script with PHP 7.4 as CLI, I
>> only get the expected result:
>>
>> PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
>> D:\test-errorhandler.php:11
>> Stack trace:
>> #0 {main}
>>    thrown in D:\test-errorhandler.php on line 11
>>
>> Do you run the above script within a larger application which already
>> has some kind of error handling in place?
> 
> No.
> 
> $ php -v
> PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
> Copyright (c) The PHP Group
> Zend Engine v3.4.0, Copyright (c) Zend Technologies
>      with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
>      with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
> tmp.MLHFJ8krVq$ cat test.php
> <?php
> set_error_handler(
>      static function (int $severity, string $message, string $file, int 
> $line): void {
>          throw new InternalErrorException($message, 0, $severity, $file, 
> $line);
>      }
> );
> xxx();
> tmp.MLHFJ8krVq$ php test.php
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in 
> /tmp/tmp.MLHFJ8krVq/test.php on line 7
> 
> Error: Call to undefined function xxx() in /tmp/tmp.MLHFJ8krVq/test.php 
> on line 7
> 
> Call Stack:
>      0.0001     394848   1. {main}() /tmp/tmp.MLHFJ8krVq/test.php:0

Does not happen here:

$ php -v
PHP 7.4.20 (cli) (built: Jun  4 2021 21:24:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans

$ cat error-test.php
<?php
set_error_handler(
     static function (int $severity, string $message, string $file, int
$line): void {
         throw new InternalErrorException($message, 0, $severity, $file,
$line);
     }
);
xxx();

$ php error-test.php

$ php error-test.php
PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
/home/arno/error-test.php:7
Stack trace:
#0 {main}
  thrown in /home/arno/error-test.php on line 7

So this is a local problem specific to your setup.

-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18668

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-21 17:06 +0200
Message-ID<saq9ua$1j8h$1@gioia.aioe.org>
In reply to#18665
Il 20/06/21 12:51, Arno Welzel ha scritto:
> So this is a local problem specific to your setup.

But I would like to understand what it is.
Meanwhile, here's another curious thing.

<?php
echo $xxx;// one message (logical)
xxx();// two messages (not logical)

Output:

Notice: Undefined variable: xxx in /tmp/tmp.5vTeAJd7Py/test.php on line 2

Call Stack:
     0.0001     391384   1. {main}() /tmp/tmp.5vTeAJd7Py/test.php:0


Fatal error: Uncaught Error: Call to undefined function xxx() in 
/tmp/tmp.5vTeAJd7Py/test.php on line 3

Error: Call to undefined function xxx() in /tmp/tmp.5vTeAJd7Py/test.php 
on line 3

Call Stack:
     0.0001     391384   1. {main}() /tmp/tmp.5vTeAJd7Py/test.php:0



[toc] | [prev] | [next] | [standalone]


#18669

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-21 19:43 +0200
Message-ID<ijc1ehFen8qU1@mid.individual.net>
In reply to#18668
alex:

> Il 20/06/21 12:51, Arno Welzel ha scritto:
>> So this is a local problem specific to your setup.
> 
> But I would like to understand what it is.

After playing around a bit with the code:

Propably because you have "display_errors = On" in your php.ini.

In my php.ini I have:

display_errors = Off

But when I change this to:

display_errors = On

Tada! Now I also get every error twice:

---------

$ php error-test.php
PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
/home/arno/error-test.php:9
Stack trace:
#0 {main}
  thrown in /home/arno/error-test.php on line 9

Fatal error: Uncaught Error: Call to undefined function xxx() in
/home/arno/error-test.php:9
Stack trace:
#0 {main}
  thrown in /home/arno/error-test.php on line 9

---------

And even if set_error_handler() will be used, it stays like this:

---------

$ php error-test.php
PHP Fatal error:  Uncaught Exception: Error catched: Division by zero in
/home/arno/error-test.php:4
Stack trace:
#0 /home/arno/error-test.php(8): {closure}()
#1 {main}
  thrown in /home/arno/error-test.php on line 4

Fatal error: Uncaught Exception: Error catched: Division by zero in
/home/arno/error-test.php:4
Stack trace:
#0 /home/arno/error-test.php(8): {closure}()
#1 {main}
  thrown in /home/arno/error-test.php on line 4

---------

So my verdict: make sure you have "display_errors = Off" in your php.ini.


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#18670

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-22 16:10 +0200
Message-ID<sasr13$1n9p$1@gioia.aioe.org>
In reply to#18669
Il 21/06/21 19:43, Arno Welzel ha scritto:
> alex:
> 
>> Il 20/06/21 12:51, Arno Welzel ha scritto:
>>> So this is a local problem specific to your setup.
>>
>> But I would like to understand what it is.
> 
> After playing around a bit with the code:
> 
> Propably because you have "display_errors = On" in your php.ini.
> 
> In my php.ini I have:
> 
> display_errors = Off
> 
> But when I change this to:
> 
> display_errors = On
> 
> Tada! Now I also get every error twice:

Exact.
When it is off, no errors are seen.
Bah...
Strange behavior: you can't get the right compromise.

> $ php error-test.php
> PHP Fatal error:  Uncaught Error: Call to undefined function xxx() in
> /home/arno/error-test.php:9
> Stack trace:
> #0 {main}
>    thrown in /home/arno/error-test.php on line 9
> 
> Fatal error: Uncaught Error: Call to undefined function xxx() in
> /home/arno/error-test.php:9
> Stack trace:
> #0 {main}
>    thrown in /home/arno/error-test.php on line 9
> 
> ---------
> 
> And even if set_error_handler() will be used, it stays like this:
> 
> ---------
> 
> $ php error-test.php
> PHP Fatal error:  Uncaught Exception: Error catched: Division by zero in
> /home/arno/error-test.php:4
> Stack trace:
> #0 /home/arno/error-test.php(8): {closure}()
> #1 {main}
>    thrown in /home/arno/error-test.php on line 4
> 
> Fatal error: Uncaught Exception: Error catched: Division by zero in
> /home/arno/error-test.php:4
> Stack trace:
> #0 /home/arno/error-test.php(8): {closure}()
> #1 {main}
>    thrown in /home/arno/error-test.php on line 4
> 
> ---------
> 
> So my verdict: make sure you have "display_errors = Off" in your php.ini.
> 
> 

So as already mentioned (if no error handler is implemented) I can't see 
any errors :|

[toc] | [prev] | [next] | [standalone]


#18671

From"J.O. Aho" <user@example.net>
Date2021-06-22 18:13 +0200
Message-ID<ijeggiFt7asU1@mid.individual.net>
In reply to#18670
On 22/06/2021 16.10, alex wrote:

> So as already mentioned (if no error handler is implemented) I can't see 
> any errors :|

php.ini:
error_log = syslog

if enabled, errors will be logged to the systems log system


example:
Jun 22 16:09:39 machine php: PHP Fatal error:  Uncaught Error: Call to 
undefined function xx() in /tmp/a.php:2
Jun 22 16:09:39 machine php: Stack trace:
Jun 22 16:09:39 machine php: #0 {main}
Jun 22 16:09:39 machine php:   thrown in /tmp/a.php on line 2

file in question:
<?php
xx();


-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#18673

Fromalex <1j9448a02@lnx159sneakemail.com.invalid>
Date2021-06-23 13:35 +0200
Message-ID<sav6a9$1f91$1@gioia.aioe.org>
In reply to#18671
Il 22/06/21 18:13, J.O. Aho ha scritto:
> 
> On 22/06/2021 16.10, alex wrote:
> 
>> So as already mentioned (if no error handler is implemented) I can't 
>> see any errors :|
> 
> php.ini:
> error_log = syslog
> 
> if enabled, errors will be logged to the systems log system
> 
> 
> example:
> Jun 22 16:09:39 machine php: PHP Fatal error:  Uncaught Error: Call to 
> undefined function xx() in /tmp/a.php:2
> Jun 22 16:09:39 machine php: Stack trace:
> Jun 22 16:09:39 machine php: #0 {main}
> Jun 22 16:09:39 machine php:   thrown in /tmp/a.php on line 2
> 
> file in question:
> <?php
> xx();
> 
> 

<?php
var_dump(ini_get('error_log'));
xxx();
------------------
/tmp/tmp.PaOxmRpwmD/test.php:2:
string(6) "syslog"

Fatal error: Uncaught Error: Call to undefined function xxx() in 
/tmp/tmp.PaOxmRpwmD/test.php on line 3

Error: Call to undefined function xxx() in /tmp/tmp.PaOxmRpwmD/test.php 
on line 3

Call Stack:
     0.0049     393400   1. {main}() /tmp/tmp.PaOxmRpwmD/test.php:0

[toc] | [prev] | [next] | [standalone]


#18672

FromArno Welzel <usenet@arnowelzel.de>
Date2021-06-23 10:24 +0200
Message-ID<ijg9dqF9084U1@mid.individual.net>
In reply to#18670
alex:

> Il 21/06/21 19:43, Arno Welzel ha scritto:
[...]
>> So my verdict: make sure you have "display_errors = Off" in your php.ini.
>>
>>
> 
> So as already mentioned (if no error handler is implemented) I can't see 
> any errors :|

I talk about display_errors and NOT error_reporting!



-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web