Reputation: 456
I have the following code which works when i put it in any blank php page,but when i try to put the code in another php page where i already have some codes in it, i get the error:
ERRNO: 8192 TEXT: Assigning the return value of new by reference is deprecated LOCATION: C:\xampp\php\PEAR\Mail.php, line 154,
include('Mail.php');
$mail = Mail::factory("mail");
$headers = array("From"=>"[email protected]", "Subject"=>"Your order has been placed ");
$body = "lol";
$mail->send("[email protected]", $headers, $body);
Upvotes: 0
Views: 1344
Reputation: 96159
You probably have an old version of PEAR::Mail. Could be version 1.1.14, the last stable version before the current stable version 1.2.0.
Try
pear channel-update pear.php.net
pear upgrade Mail
to get the latest version.
edit: This is not actually part of the answer but doesn't fit in a comment either:
For debugging purposes replace the factory function in pear/Mail.php by
function &factory($driver, $params = array())
{
$driver = strtolower($driver);
echo '<pre>Debug: driver=', $driver, "</pre>\n";
echo '<pre>Debug: include_path=', get_include_path(), "</pre>\n";
echo '<pre>Debug: cwd=', getcwd(), "</pre>\n";
echo '<pre>Debug: __FILE__=', __FILE__, "</pre>\n";
require_once 'Mail/' . $driver . '.php';
$class = 'Mail_' . $driver;
if (class_exists($class)) {
$mailer = new $class($params);
return $mailer;
}
else {
throw new Exception('Unable to find class for driver ' . $driver);
}
}
Upvotes: 1