<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP 5.0.5: Fatal error: Only variables can be passed by reference</title>
	<atom:link href="http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/feed/" rel="self" type="application/rss+xml" />
	<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/</link>
	<description>Random developer notes</description>
	<lastBuildDate>Thu, 14 Jan 2010 08:40:36 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Caso Real: PHP 5.0.5: Fatal error: Only variables can be passed by reference (y Solucion) &#124; Fortman.info</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1276</link>
		<dc:creator>Caso Real: PHP 5.0.5: Fatal error: Only variables can be passed by reference (y Solucion) &#124; Fortman.info</dc:creator>
		<pubDate>Fri, 24 Jul 2009 01:10:38 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1276</guid>
		<description>[...] Me resulta interesante ahora que casi no programo casi nada, el hecho de tocarme con estos problemas y la estresante emocionante busqueda de solucion. Y como para variar no tengo mucho material para postear (o tengo demasiado que no me decido por nada) he considerado apropiado escribir sobre este incidente, que me ha vuelto a ocurrir, si me ha vuelto porque es la segunda vez que me toco con el mismo problema y sabiendo el escenario en el cual tenia que trabajar, no tome la precaucion de respaldar la solucion y copiarla, aunque ahora la solucion la pude generar solo recordando el problema que lo encontre detallado en: Stickblog [...]</description>
		<content:encoded><![CDATA[<p>[...] Me resulta interesante ahora que casi no programo casi nada, el hecho de tocarme con estos problemas y la estresante emocionante busqueda de solucion. Y como para variar no tengo mucho material para postear (o tengo demasiado que no me decido por nada) he considerado apropiado escribir sobre este incidente, que me ha vuelto a ocurrir, si me ha vuelto porque es la segunda vez que me toco con el mismo problema y sabiendo el escenario en el cual tenia que trabajar, no tome la precaucion de respaldar la solucion y copiarla, aunque ahora la solucion la pude generar solo recordando el problema que lo encontre detallado en: Stickblog [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shan Shui</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1264</link>
		<dc:creator>Shan Shui</dc:creator>
		<pubDate>Thu, 02 Jul 2009 18:12:37 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1264</guid>
		<description>If you do sort($array = array(2, 1)); while on E_STRICT, you will get this message:

Strict Standards: Only variables *should be* passed by reference 

*as opposed to &quot;can be&quot; on a fatal error

So basically, PHP has an order of preference in regards to this issue:

Recommended - $array = array(2, 1); sort($array);
Still accepted - sort($array = array(2, 1));
FATAL ERROR!!! - sort(array(2, 1));</description>
		<content:encoded><![CDATA[<p>If you do sort($array = array(2, 1)); while on E_STRICT, you will get this message:</p>
<p>Strict Standards: Only variables *should be* passed by reference </p>
<p>*as opposed to &#8220;can be&#8221; on a fatal error</p>
<p>So basically, PHP has an order of preference in regards to this issue:</p>
<p>Recommended &#8211; $array = array(2, 1); sort($array);<br />
Still accepted &#8211; sort($array = array(2, 1));<br />
FATAL ERROR!!! &#8211; sort(array(2, 1));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1194</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Tue, 28 Apr 2009 09:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1194</guid>
		<description>For me the change makes sense cause it is clearer now than before. A Reference has to be a var. Northing more.
But I understand: its annoying that old code suddenly doesn&#039;t work anymore.

However, litte help for those having trouble (example with sort() wich works with a reference).

Old (-&gt;will lead to error):
&gt; sort(array(2,3,1));

Correct for newer PHP:
&gt; $array = array(2,3,1);
&gt; sort($array)
or
&gt; sort($array = array(2,3,1))</description>
		<content:encoded><![CDATA[<p>For me the change makes sense cause it is clearer now than before. A Reference has to be a var. Northing more.<br />
But I understand: its annoying that old code suddenly doesn&#8217;t work anymore.</p>
<p>However, litte help for those having trouble (example with sort() wich works with a reference).</p>
<p>Old (-&gt;will lead to error):<br />
&gt; sort(array(2,3,1));</p>
<p>Correct for newer PHP:<br />
&gt; $array = array(2,3,1);<br />
&gt; sort($array)<br />
or<br />
&gt; sort($array = array(2,3,1))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Shennan</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1178</link>
		<dc:creator>Christopher Shennan</dc:creator>
		<pubDate>Fri, 27 Mar 2009 11:45:06 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1178</guid>
		<description>Thanks guys.  Couldn&#039;t understand why I had this working before but was having problems now.</description>
		<content:encoded><![CDATA[<p>Thanks guys.  Couldn&#8217;t understand why I had this working before but was having problems now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1136</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sat, 17 Jan 2009 00:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1136</guid>
		<description>Stickman, you&#039;re right. Dev Null, you&#039;re wrong. People learn by example, and if the official examples out there are flawed from the outset, then it&#039;s not the end user that is wrong. The attitude from the php dev is completely wrong; the arrogance is heavily misplaced.

Thanks for pointing out the fix anyway, Stickman.</description>
		<content:encoded><![CDATA[<p>Stickman, you&#8217;re right. Dev Null, you&#8217;re wrong. People learn by example, and if the official examples out there are flawed from the outset, then it&#8217;s not the end user that is wrong. The attitude from the php dev is completely wrong; the arrogance is heavily misplaced.</p>
<p>Thanks for pointing out the fix anyway, Stickman.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1100</link>
		<dc:creator>Evan</dc:creator>
		<pubDate>Tue, 18 Nov 2008 02:39:54 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1100</guid>
		<description>An array is an object, not a variable, and objects are passed by reference, not duplicated. Thus it&#039;s absolutely necessary to duplicate it before using something like array_pop by first setting the variable.

This one threw me for a loop for a while as well, and I didn&#039;t even notice there was an issue until I implemented a customer error handler on one of my sites.

** changing code ** ...</description>
		<content:encoded><![CDATA[<p>An array is an object, not a variable, and objects are passed by reference, not duplicated. Thus it&#8217;s absolutely necessary to duplicate it before using something like array_pop by first setting the variable.</p>
<p>This one threw me for a loop for a while as well, and I didn&#8217;t even notice there was an issue until I implemented a customer error handler on one of my sites.</p>
<p>** changing code ** &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NextGEN Gallery ???????? Fatal error: Only variables can be passed by reference &#124; ? Shian's Blog</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1050</link>
		<dc:creator>NextGEN Gallery ???????? Fatal error: Only variables can be passed by reference &#124; ? Shian's Blog</dc:creator>
		<pubDate>Sun, 27 Jul 2008 16:20:16 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1050</guid>
		<description>[...] ??? PHP 5.0.5: Fatal error: Only variables can be passed by reference [...]</description>
		<content:encoded><![CDATA[<p>[...] ??? PHP 5.0.5: Fatal error: Only variables can be passed by reference [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stickman</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1016</link>
		<dc:creator>Stickman</dc:creator>
		<pubDate>Mon, 30 Jun 2008 07:57:47 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1016</guid>
		<description>Wow, a rave from the grave!

&gt; Um, yeah. They should. Just as anyone working in any
&gt; language should be aware of the internals of that language.

I don&#039;t agree. A programming language should be self-explanatory: if it&#039;s doing something wrong behind the scenes then that the fault of those who wrote the language, not those who are using it.

When I wrote this article I wasn&#039;t arguing against the fix. What concerned me was the attitude of the PHP developers when announcing it, trying to blame the users rather than take responsibility for the error themselves. If the construct was causing problems, it shouldn&#039;t have been legal in the first place.</description>
		<content:encoded><![CDATA[<p>Wow, a rave from the grave!</p>
<p>> Um, yeah. They should. Just as anyone working in any<br />
> language should be aware of the internals of that language.</p>
<p>I don&#8217;t agree. A programming language should be self-explanatory: if it&#8217;s doing something wrong behind the scenes then that the fault of those who wrote the language, not those who are using it.</p>
<p>When I wrote this article I wasn&#8217;t arguing against the fix. What concerned me was the attitude of the PHP developers when announcing it, trying to blame the users rather than take responsibility for the error themselves. If the construct was causing problems, it shouldn&#8217;t have been legal in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dev Null</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-1014</link>
		<dc:creator>Dev Null</dc:creator>
		<pubDate>Fri, 27 Jun 2008 15:19:56 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-1014</guid>
		<description>&gt; So apparently all PHP developers should have been aware 
&gt; (somehow) of the internal workings of PHP

Um, yeah. They should. Just as anyone working in any language should be aware of the internals of that language.

One of the reasons that PHP developers don&#039;t get much respect (and by and large don&#039;t deserve much) is because most don&#039;t have any knowledge of the basics of programming - such as the difference between passing by value and passing by reference. Anyone with training in a lower-level language such as C or Java understands that, but people whose previous &quot;programming&quot; background is limited to HTML won&#039;t.

One of PHP&#039;s greatest virtues is that it is a dead-simple language to learn. One of PHP&#039;s greatest weaknesses is that it is a dead-simple language to learn. And as a result, probably 95% of the PHP code out there is utter crap.</description>
		<content:encoded><![CDATA[<p>&gt; So apparently all PHP developers should have been aware<br />
&gt; (somehow) of the internal workings of PHP</p>
<p>Um, yeah. They should. Just as anyone working in any language should be aware of the internals of that language.</p>
<p>One of the reasons that PHP developers don&#8217;t get much respect (and by and large don&#8217;t deserve much) is because most don&#8217;t have any knowledge of the basics of programming &#8211; such as the difference between passing by value and passing by reference. Anyone with training in a lower-level language such as C or Java understands that, but people whose previous &#8220;programming&#8221; background is limited to HTML won&#8217;t.</p>
<p>One of PHP&#8217;s greatest virtues is that it is a dead-simple language to learn. One of PHP&#8217;s greatest weaknesses is that it is a dead-simple language to learn. And as a result, probably 95% of the PHP code out there is utter crap.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://the-stickman.com/web-development/php/php-505-fatal-error-only-variables-can-be-passed-by-reference/comment-page-1/#comment-591</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Sat, 01 Dec 2007 07:15:46 +0000</pubDate>
		<guid isPermaLink="false">http://the-stickman.com/?p=16#comment-591</guid>
		<description>Any suggestions of getting this code re written?


$my_temp_variable = strtolower($file_name1);</description>
		<content:encoded><![CDATA[<p>Any suggestions of getting this code re written?</p>
<p>$my_temp_variable = strtolower($file_name1);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
