On Mon, 2003-06-23 at 15:12, Jeff Stewart wrote:
> I'm using PHP 4.3.1 as an Apache module.  No matter what I try, I can't get
> set_error_handler() to do anything other than return false.  Under what
> circumstances does this happen?
> 
> <?php
> function doobee($errno, $errstr, $errfile, $errline, $errcontext) {
>  echo "Handled.";
> }
>
> $retval = true;
> if (($retval = set_error_handler("doobee")) == false) echo "Didn't work.";
> // echos every time
> ?>


Note that it's not necessarily returning false here; it could be 0, or
the empty string, or an empty array...use the '===' operator to test
whether two operands are of the same type and evaluate to the same
value.

   http://www.php.net/manual/en/language.operators.comparison.php

Noting from the manual that set_error_handler() returns FALSE on error,
or the name of the previously defined error handler (if there was one)
on success, I am thinking it's probably just returning the empty
string--you likely didn't have an error handler set up before.

   http://www.php.net/set_error_handler

So replace your '==' with '===' and you should be good to go.


Hope this helps,

Torben

> --
> Jeff S.

-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to