Page 1 of 1
PHP Newbie: Fatal Error Problem
Posted: Thu Jun 05, 2003 11:01 am
by todderoni
I am trying to set up a simple site as outlined in the PHP book "PHP MySQL Website Programming: Problem - Design - Solution". I'm setting it up on Mac OS X 10.2.5, PHP 4.1.2 w/ MySQL & Apache. It's mostly working w/ the exception of the following Fatal Error:
Code: Select all
Fatal error: Call to undefined function: raiseerror() in /System/Library/PHP/Mail.php on line 51
The odd thing is that the function called is actually raiseError(), whereas the error message claims the raiseerror() function is called (note the capital e)
My include_path stuff is all set up, and the raiseError function appears to be available via the referenced PEAR.php file. Not sure what to look for at this point. I can't seem to find any threads on the issue. Am I missing something simple?
Re: Fatal Error!
Posted: Thu Jun 05, 2003 1:25 pm
by easyteck
Is supose that the raiseError() function is in some include file. where exactly is located this file? and what exactly is the include line in your code? somewere around there is the problem!
Explain this and could help!
Re: Fatal Error!
Posted: Thu Jun 05, 2003 1:38 pm
by todderoni
The raiseError() function is located in PEAR.php and is referenced in Mail.php as follows:
PEAR.php is located in the same directory as Mail.php. Here is the actual function call:
Code: Select all
function factory($driver, $params = array())
{
$driver = strtolower($driver);
@include_once 'Mail/' . $driver . '.php';
$class = 'Mail_' . $driver;
if (class_exists($class)) {
return new $class($params);
} else {
return $this->raiseError('Unable to find class for driver ' . $driver);
}
}
And lastly, here is the function found in PEAR.php
Code: Select all
function &raiseError($message = null,
$code = null,
$mode = null,
$options = null,
$userinfo = null,
$error_class = null,
$skipmsg = false)
{
// The error is yet a PEAR error object
if (is_object($message)) {
$code = $message->getCode();
$userinfo = $message->getUserInfo();
$error_class = $message->getType();
$message = $message->getMessage();
}
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
if ($exp[0] == "*" ||
(is_int(reset($exp)) && in_array($code, $exp)) ||
(is_string(reset($exp)) && in_array($message, $exp))) {
$mode = PEAR_ERROR_RETURN;
}
}
if ($mode === null) {
if (isset($this) && isset($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
} else {
$mode = $GLOBALS['_PEAR_default_error_mode'];
}
}
if ($mode == PEAR_ERROR_TRIGGER && $options === null) {
if (isset($this)) {
if (isset($this->_default_error_options)) {
$options = $this->_default_error_options;
}
} else {
$options = $GLOBALS['_PEAR_default_error_options'];
}
}
if ($mode == PEAR_ERROR_CALLBACK) {
if (!is_string($options) &&
!(is_array($options) && sizeof($options) == 2 &&
is_object($options[0]) && is_string($options[1])))
{
if (isset($this) && isset($this->_default_error_options)) {
$options = $this->_default_error_options;
} else {
$options = $GLOBALS['_PEAR_default_error_options'];
}
}
} else {
if ($options === null) {
if (isset($this)) {
if (isset($this->_default_error_options)) {
$options = $this->_default_error_options;
}
} else {
$options = $GLOBALS['_PEAR_default_error_options'];
}
}
}
if ($error_class !== null) {
$ec = $error_class;
} elseif (isset($this) && isset($this->_error_class)) {
$ec = $this->_error_class;
} else {
$ec = 'PEAR_Error';
}
if ($skipmsg) {
return new $ec($code, $mode, $options, $userinfo);
} else {
return new $ec($message, $code, $mode, $options, $userinfo);
}
}
In my .htaccess file I have specified each of the directories to access for referenced files. I'm at a loss

Re: Fatal Error!
Posted: Thu Jun 05, 2003 6:16 pm
by easyteck
Look:
I don't think the problem is in the require_once line 'cause it would raised the: Failed opening required 'PEAR.php' .... error.
You are using the $this object instance under a function... doesn't match the scope until you use a
declaration inside the function, otherwise the $this variable is referencing something else...
Finally, I see the raiseError() function is a class method... so be shure that the $this is actually referencing to that class instance in your Mail.php file;
P.S. Don't worry about the capital e not showed in the error description... Don't know why PHP does this but its normal!
Re: Fatal Error!
Posted: Fri Jun 06, 2003 3:37 am
by twigletmac
easyteck wrote:P.S. Don't worry about the capital e not showed in the error description... Don't know why PHP does this but its normal!
Yup, although variable names are case-sensitive in PHP, function names are not so raiseError(), RaiseError(), raiseerror() etc. all refer to the same function.
Mac