PEAR_Error::toString raise a notice error
| From: | Laurent Laville | Date: | Fri, 20 Aug 2004 16:45:39 +0000 |
| Subject: | PEAR_Error::toString raise a notice error | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-32789@lists.php.net to get a copy of this message | ||
Hi all,
I hope i'm not the only one to have noticed that PEAR_Error object
and its UserInfo property can't manage an array, especially with the toString() method.
As it's trivial and not really an error, i've not post a bug report for that.
Actual result is :
Notice: Array to string conversion in e:\wamp\php4\PEAR\PEAR.php on line 960
With (of course) error_reporting = E_ALL
Expected result :
none error raised
Reproduced with :
<?php
include_once 'PEAR.php';
$err = array('package' => 'myPackage', 'time' => time());
$e = PEAR::raiseError('my compatible PEAR_Error message', -100, null, null, $err);
if (is_object($e)) {
if (is_a($e,'PEAR_Error')) {
die('<h1>Catch PEAR_Error</h1>'. $e->toString());
}
}
?>
And also with PEAR_ErrorStack (in compatible PEAR_Error mode) :
<?php
include_once 'PEAR/ErrorStack.php';
$myStack = &PEAR_ErrorStack::singleton('myPackage', false, false, true);
$e = $myStack->push(-100, 'error', null, 'my compatible PEAR_Error message');
if (is_object($e)) {
if (is_a($e,'PEAR_Error')) {
die('<h1>Catch PEAR_Error</h1>'. $e->toString());
}
}
?>
Best regards,
Laurent Laville