<?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 &#8211; Do not rely on set_time_limit too much	</title>
	<atom:link href="https://www.binarytides.com/php-set-time-limit/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/php-set-time-limit/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Tue, 16 Jul 2019 15:45:26 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: David Spector / Springtime Software		</title>
		<link>https://www.binarytides.com/php-set-time-limit/comment-page-1/#comment-202012</link>

		<dc:creator><![CDATA[David Spector / Springtime Software]]></dc:creator>
		<pubDate>Tue, 16 Jul 2019 15:45:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=5269#comment-202012</guid>

					<description><![CDATA[I sometimes have bugs in my PHP code that causes recursions involving exception handling and possibly other operations. Unfortunately, I haven&#039;t been able to create a tiny example.

In these cases, which have happened for me several times, set_time_limit fails, and the browser keeps trying to load the PHP output, either with an infinite loop or with the fatal error message which is the topic of this question.

By reducing the allowed allocation size by adding

ini_set(&#039;memory_limit&#039;,&#039;1M&#039;);

near the beginning of your code you should be able to prevent the fatal error. Then you may be left with a program that terminates, but is still difficult to debug.

At this point insert BreakLoop() calls inside your program to gain control and find out what loop or recursion in your program is causing the problem.

The definition of BreakLoop is as follows:

function BreakLoop($MaxRepetitions=500,$LoopSite=&quot;unspecified&quot;)
    {
    static $Sites=[];
    if (!@$Sites[$LoopSite] &#124;&#124; !$MaxRepetitions)
        $Sites[$LoopSite]=[&#039;n&#039;=&#062;0, &#039;if&#039;=&#062;0];
    if (!$MaxRepetitions)
        return;
    if (++$Sites[$LoopSite][&#039;n&#039;] &#062;= $MaxRepetitions)
        {
        $S=debug_backtrace(); // array_reverse
        $info=$S[0];
        $File=$info[&#039;file&#039;];
        $Line=$info[&#039;line&#039;];
        exit(&quot;*** Loop for site $LoopSite was interrupted after $MaxRepetitions repetitions. In file $File at line $Line.&quot;);
        }
    } // BreakLoop

The $LoopSite argument can be the name of a function in your code. It isn&#039;t really necessary, since the error message you will get will point you to the line containing the BreakLoop() call.]]></description>
			<content:encoded><![CDATA[<p>I sometimes have bugs in my PHP code that causes recursions involving exception handling and possibly other operations. Unfortunately, I haven&#8217;t been able to create a tiny example.</p>
<p>In these cases, which have happened for me several times, set_time_limit fails, and the browser keeps trying to load the PHP output, either with an infinite loop or with the fatal error message which is the topic of this question.</p>
<p>By reducing the allowed allocation size by adding</p>
<p>ini_set(&#8216;memory_limit&#8217;,&#8217;1M&#8217;);</p>
<p>near the beginning of your code you should be able to prevent the fatal error. Then you may be left with a program that terminates, but is still difficult to debug.</p>
<p>At this point insert BreakLoop() calls inside your program to gain control and find out what loop or recursion in your program is causing the problem.</p>
<p>The definition of BreakLoop is as follows:</p>
<p>function BreakLoop($MaxRepetitions=500,$LoopSite=&#8221;unspecified&#8221;)<br />
    {<br />
    static $Sites=[];<br />
    if (!@$Sites[$LoopSite] || !$MaxRepetitions)<br />
        $Sites[$LoopSite]=[&#8216;n&#8217;=&gt;0, &#8216;if&#8217;=&gt;0];<br />
    if (!$MaxRepetitions)<br />
        return;<br />
    if (++$Sites[$LoopSite][&#8216;n&#8217;] &gt;= $MaxRepetitions)<br />
        {<br />
        $S=debug_backtrace(); // array_reverse<br />
        $info=$S[0];<br />
        $File=$info[&#8216;file&#8217;];<br />
        $Line=$info[&#8216;line&#8217;];<br />
        exit(&#8220;*** Loop for site $LoopSite was interrupted after $MaxRepetitions repetitions. In file $File at line $Line.&#8221;);<br />
        }<br />
    } // BreakLoop</p>
<p>The $LoopSite argument can be the name of a function in your code. It isn&#8217;t really necessary, since the error message you will get will point you to the line containing the BreakLoop() call.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Chris Harrison		</title>
		<link>https://www.binarytides.com/php-set-time-limit/comment-page-1/#comment-67724</link>

		<dc:creator><![CDATA[Chris Harrison]]></dc:creator>
		<pubDate>Tue, 06 Jan 2015 22:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=5269#comment-67724</guid>

					<description><![CDATA[Hopefully with the next version of PHP, multithreading will reduce the amount of long extended process scripts clogging up PHP developers workflows.
Heres hoping anyway :)]]></description>
			<content:encoded><![CDATA[<p>Hopefully with the next version of PHP, multithreading will reduce the amount of long extended process scripts clogging up PHP developers workflows.<br />
Heres hoping anyway :)</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
