<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
        <description> Hi Stas,

I did run the test of bug #55871 and got memory leaks. This patch
remove them. Could you please review the patch and if it is Ok i'll
commit it to 5.4

Thanks
Pierrick
Index: NEWS
===================================================================
--- NEWS	(revision 322482)
+++ NEWS	(working copy)
@@ -2,6 +2,9 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jan 2012, PHP 5.4.0
 
+- Standard:
+  . Fixed memory leak in substr_replace. (Pierrick)
+
 19 Jan 2012, PHP 5.4.0 RC6
 
 - Core:
Index: ext/standard/string.c
===================================================================
--- ext/standard/string.c	(revision 322482)
+++ ext/standard/string.c	(working copy)
@@ -2518,6 +2518,9 @@
 
 					if(Z_REFCOUNT_P(orig_str) != refcount) {
 						php_error_docref(NULL TSRMLS_CC, E_WARNING, &amp;quot;Argument was modified while replacing&amp;quot;);
+						if(Z_TYPE_PP(tmp_repl) != IS_STRING) {
+							zval_dtor(repl_str);
+						}
 						break;
 					}
 
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php</description>
        <link>http://www.serverphorums.com/read.php?7,433190,433190#msg-433190</link>
        <lastBuildDate>Sun, 19 May 2013 19:14:04 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433476#msg-433476</guid>
            <title>Re: [PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433476#msg-433476</link>
            <description><![CDATA[ Yes :) I sent you an other mail about this bug yesterday to confirm<br />
that I can commit it.<br />
<br />
P.<br />
<br />
On 20 January 2012 13:05, Stas Malyshev &lt;smalyshev@sugarcrm.com&gt; wrote:<br />
&gt; Hi!<br />
&gt;<br />
&gt;<br />
&gt;&gt; Nevery mind. Apparently Dmitry committed a patch for this one.<br />
&gt;<br />
&gt;<br />
&gt; I think what he committed was a patch for another problem - double free in<br />
&gt; traits.<br />
&gt;<br />
&gt; --<br />
&gt; Stanislav Malyshev, Software Architect<br />
&gt; SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
&gt; (408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Pierrick Charron</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 19:32:38 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433465#msg-433465</guid>
            <title>Re: [PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433465#msg-433465</link>
            <description><![CDATA[ Hi!<br />
<br />
&gt; Nevery mind. Apparently Dmitry committed a patch for this one.<br />
<br />
I think what he committed was a patch for another problem - double free <br />
in traits.<br />
-- <br />
Stanislav Malyshev, Software Architect<br />
SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
(408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Stas Malyshev</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 19:11:26 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433314#msg-433314</guid>
            <title>Re: [PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433314#msg-433314</link>
            <description><![CDATA[ Nevery mind. Apparently Dmitry committed a patch for this one.<br />
<br />
P.<br />
<br />
On 20 January 2012 08:04, Pierrick Charron &lt;pierrick@webstart.fr&gt; wrote:<br />
&gt; Ok i'll only commit it on trunk and 5.3 for right now and keep the<br />
&gt; patch ready to apply. What about the other one I sent you (60809) ?<br />
&gt;<br />
&gt; On 20 January 2012 02:10, Stas Malyshev &lt;smalyshev@sugarcrm.com&gt; wrote:<br />
&gt;&gt; Hi!<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;&gt; I did run the test of bug #55871 and got memory leaks. This patch<br />
&gt;&gt;&gt; remove them. Could you please review the patch and if it is Ok i'll<br />
&gt;&gt;&gt; commit it to 5.4<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; Please hold it for now. It's not a critical issue, if we'd have another RC<br />
&gt;&gt; for different reason, we can also have it in as it doesn't look to<br />
&gt;&gt; dangerous.<br />
&gt;&gt; --<br />
&gt;&gt; Stanislav Malyshev, Software Architect<br />
&gt;&gt; SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
&gt;&gt; (408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Pierrick Charron</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 14:20:39 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433309#msg-433309</guid>
            <title>Re: [PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433309#msg-433309</link>
            <description><![CDATA[ Ok i'll only commit it on trunk and 5.3 for right now and keep the<br />
patch ready to apply. What about the other one I sent you (60809) ?<br />
<br />
On 20 January 2012 02:10, Stas Malyshev &lt;smalyshev@sugarcrm.com&gt; wrote:<br />
&gt; Hi!<br />
&gt;<br />
&gt;<br />
&gt;&gt; I did run the test of bug #55871 and got memory leaks. This patch<br />
&gt;&gt; remove them. Could you please review the patch and if it is Ok i'll<br />
&gt;&gt; commit it to 5.4<br />
&gt;<br />
&gt;<br />
&gt; Please hold it for now. It's not a critical issue, if we'd have another RC<br />
&gt; for different reason, we can also have it in as it doesn't look to<br />
&gt; dangerous.<br />
&gt; --<br />
&gt; Stanislav Malyshev, Software Architect<br />
&gt; SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
&gt; (408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Pierrick Charron</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 14:11:26 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433223#msg-433223</guid>
            <title>Re: [PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433223#msg-433223</link>
            <description><![CDATA[ Hi!<br />
<br />
&gt; I did run the test of bug #55871 and got memory leaks. This patch<br />
&gt; remove them. Could you please review the patch and if it is Ok i'll<br />
&gt; commit it to 5.4<br />
<br />
Please hold it for now. It's not a critical issue, if we'd have another <br />
RC for different reason, we can also have it in as it doesn't look to <br />
dangerous.<br />
-- <br />
Stanislav Malyshev, Software Architect<br />
SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
(408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Stas Malyshev</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 08:20:08 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,433190,433190#msg-433190</guid>
            <title>[PHP-DEV] Remove memory leak in PHP5.4 for bug 55971</title>
            <link>http://www.serverphorums.com/read.php?7,433190,433190#msg-433190</link>
            <description><![CDATA[ Hi Stas,<br />
<br />
I did run the test of bug #55871 and got memory leaks. This patch<br />
remove them. Could you please review the patch and if it is Ok i'll<br />
commit it to 5.4<br />
<br />
Thanks<br />
Pierrick<br />
Index: NEWS<br />
===================================================================<br />
--- NEWS	(revision 322482)<br />
+++ NEWS	(working copy)<br />
@@ -2,6 +2,9 @@<br />
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||<br />
 ?? Jan 2012, PHP 5.4.0<br />
 <br />
+- Standard:<br />
+  . Fixed memory leak in substr_replace. (Pierrick)<br />
+<br />
 19 Jan 2012, PHP 5.4.0 RC6<br />
 <br />
 - Core:<br />
Index: ext/standard/string.c<br />
===================================================================<br />
--- ext/standard/string.c	(revision 322482)<br />
+++ ext/standard/string.c	(working copy)<br />
@@ -2518,6 +2518,9 @@<br />
 <br />
 					if(Z_REFCOUNT_P(orig_str) != refcount) {<br />
 						php_error_docref(NULL TSRMLS_CC, E_WARNING, &quot;Argument was modified while replacing&quot;);<br />
+						if(Z_TYPE_PP(tmp_repl) != IS_STRING) {<br />
+							zval_dtor(repl_str);<br />
+						}<br />
 						break;<br />
 					}<br />
 <br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Pierrick Charron</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 20 Jan 2012 04:40:03 +0100</pubDate>
        </item>
    </channel>
</rss>
