Solved

error log: PHP Notice:  Only variable references should be returned by reference

Posted on 2011-02-21
6
928 Views
Last Modified: 2012-05-11
[Sat Feb 05 10:03:03 2011] [client 76.168.200.119] PHP Notice:  Only variable references should be returned by reference in /home/derm/fpdf/tutorial/Mail_Mime/mime.php on line 356, referer: https://midvalleydermatology.com/history/historyform.php

code error is referring to:

function &_addMixedPart()
    {
        $params['content_type'] = 'multipart/mixed';
        return new Mail_mimePart('', $params);
    }
0
Comment
Question by:phillystyle123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:DoCBReeD
ID: 34948054
Are you trying to generate a pdf and email it?
0
 

Author Comment

by:phillystyle123
ID: 34948344
yes - to clarify,the script already works -i'm just trying to figure out why i'm getting these log errors
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 34948832

You can only return variables by reference, not the result of a statement.

Note the "&" before the function name.

http://php.net/manual/en/language.references.return.php

Try this:

function &_addMixedPart()
    {
        $params['content_type'] = 'multipart/mixed';
        $return = new Mail_mimePart('', $params);
        return $return;
} 

Open in new window

0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 500 total points
ID: 34949493
This little bug has been in the Mail_mime package for years. Just ignore it.
0
 
LVL 1

Expert Comment

by:DoCBReeD
ID: 34949530
Try the following w/out using mime.  

		$pdfdoc = $pdf->Output("example.pdf", 'S');

    
	$to = "Youremail@yourdot.com";
	$from = "Youremail@yourdot.com";
	$subject = "Subject";
	$message = "<p>Please see the attachment.</p>";
	$separator = md5(time());
	$eol = PHP_EOL; 
	$filename = "example.pdf";
    
	$attachment = chunk_split(base64_encode($pdfdoc));
	$headers = "From: ".$from.$eol;
	$headers .= "MIME-Version: 1.0".$eol;
	$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
	$headers .= "Content-Transfer-Encoding: 7bit".$eol;
	$headers .= "This is a MIME encoded message.".$eol.$eol;
	$headers .= "--".$separator.$eol;
	$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
	$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
	$headers .= $message.$eol.$eol;
	$headers .= "--".$separator.$eol;
	$headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
	$headers .= "Content-Transfer-Encoding: base64".$eol;
	$headers .= "Content-Disposition: attachment".$eol.$eol;
	$headers .= $attachment.$eol.$eol;
	$headers .= "--".$separator."--";

	if(mail($to, $subject, "$message", $headers)){
		?>
	<script type="text/javascript"><!--
    alert("Alert message!");
    window.location = "index.php";
    --></script>
	<?php
}
?>

Open in new window

0
 

Author Closing Comment

by:phillystyle123
ID: 34975701
Thanks!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question