<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Professional PHP &#187; pear</title>
	<atom:link href="http://www.procata.com/blog/archives/tag/pear/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.procata.com/blog</link>
	<description>PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.</description>
	<lastBuildDate>Fri, 10 Dec 2010 17:23:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>un-PEAR-ing</title>
		<link>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/</link>
		<comments>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 21:21:17 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/</guid>
		<description><![CDATA[Astonishing.  I&#8217;m quite surprised.  I thought PHPUnit was fairly well integrated into PEAR  (pear run-tests).  I&#8217;m not sure if this is a fork, or if PEAR will continue to use PHPUnit as an external dependency?
I&#8217;ve never been a PEAR fan.  My experiences being peripherally involved with the XML_HTMLSax package weren&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sebastian-bergmann.de/blog/archives/610-So-Long,-and-Thanks-for-All-the-PEARs.html">Astonishing</a>.  I&#8217;m quite surprised.  I thought PHPUnit was fairly well integrated into PEAR  (pear run-tests).  I&#8217;m not sure if this is a fork, or if PEAR will continue to use PHPUnit as an external dependency?</p>
<p>I&#8217;ve never been a PEAR fan.  My experiences being peripherally involved with the <a href="http://pear.php.net/package/XML_HTMLSax/">XML_HTMLSax</a> package weren&#8217;t encouraging.  However, my opinion of PEAR has turned around in recent years thanks to work such as channels in the pear installer and MDB2.</p>
<p>I hope this doesn&#8217;t end up a fork.  I see little sense in that.  I&#8217;ll be interested in seeing the PEAR response.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Improving Web Application Installation as a Security Imperative</title>
		<link>http://www.procata.com/blog/archives/2005/12/07/improving-web-application-installation-as-a-security-imperative/</link>
		<comments>http://www.procata.com/blog/archives/2005/12/07/improving-web-application-installation-as-a-security-imperative/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 05:18:13 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pear-installer]]></category>
		<category><![CDATA[php-deployment]]></category>
		<category><![CDATA[php-security]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=159</guid>
		<description><![CDATA[It looks there is a Mambo worm out now.  I read Hackers Hitting Popular Apps a couple of weeks ago and it mentioned that hackers are targeting PHP apps among other things.  Dog bites man for some.  More interesting was this quote:

&#8220;The bottom line is that security has been set back nearly [...]]]></description>
			<content:encoded><![CDATA[<p>It looks there is a <a href="http://www.christopher-kunz.de/serendipity/archives/76-Mambo-worm-in-the-wild.html">Mambo worm</a> out now.  I read <a href="http://news.yahoo.com/s/cmp/20051122/tc_cmp/174400852">Hackers Hitting Popular Apps</a> a couple of weeks ago and it mentioned that hackers are targeting PHP apps among other things.  Dog bites man for some.  More interesting was this quote:</p>
<blockquote><p>
&#8220;The bottom line is that security has been set back nearly six years in the past 18 months,&#8221; Alan Paller, director of research for the SANS Institute, wrote in an E-mail. &#8220;Six years ago, attackers targeted operating systems and the operating system vendors didn&#8217;t do automated patching. In the intervening years, automated patching protected everyone from government to grandma. Now the attackers are targeting popular applications, and the vendors of those applications do not do automated patching.&#8221;
</p></blockquote>
<p>I&#8217;ve advocated <a href="http://www.procata.com/blog/archives/2004/11/24/installing-web-applications/">better web application installation</a> for a while, but as a usability issue.  Increasingly, it is also a security issue.   Just another example of why I think the PEAR installer is  important.  (and why I hope <a href="http://www.procata.com/blog/archives/2005/12/05/zend-framework-webcast/">Zend PHP Framework is released on a PEAR channel</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/12/07/improving-web-application-installation-as-a-security-imperative/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zend Framework Webcast</title>
		<link>http://www.procata.com/blog/archives/2005/12/05/zend-framework-webcast/</link>
		<comments>http://www.procata.com/blog/archives/2005/12/05/zend-framework-webcast/#comments</comments>
		<pubDate>Mon, 05 Dec 2005 20:42:46 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[active-record]]></category>
		<category><![CDATA[dependency-management]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pear-installer]]></category>
		<category><![CDATA[zend-framework]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=164</guid>
		<description><![CDATA[I guess I missed the Zend PHP Framework webcast on Friday.  I was looking forward to it, but I signed up a while ago and forgot about it.  By the time I got the reminder email, it was too late.  Fortunately, the recording is now available.  If you have an interest [...]]]></description>
			<content:encoded><![CDATA[<p>I guess I missed the Zend PHP Framework webcast on Friday.  I was looking forward to it, but I signed up a while ago and forgot about it.  By the time I got the reminder email, it was too late.  Fortunately, the recording is <a href="http://www.phparch.com/webcasts/recordings/dec0205_zend.php">now available</a>.  If you have an interest in ZPF or frameworks in general, you should watch this.</p>
<p><a href="http://shiflett.org/archive/171">Chris Shiflet</a> and <a href="http://blog.phpdeveloper.org/?p=23">PHP Developer</a> both have coverage of the webcast.  The webcast even <a href="http://www.loudthinking.com/arc/000544.html">caught some attention</a> from the Rails camp.</p>
<p>I won&#8217;t try to summarize the webcast here, but instead offer a few impressions.</p>
<p>I found the webcast to be interesting, although it didn&#8217;t really answer the primary questions I have about the structure of the front controller and form processing.  ZActiveRecord, ZMail, and ZSearch are fine components, but my interest lies in the controllers because that is the area where there is the least consensus about the state of the art.  One red flag for me was the suggestion of putting business logic in actions.  Nothing but a high level overview was given of the controllers, but this perks my ears as an issue in <a href="http://www.phpwact.org/pattern/model_view_controller">MVC separation</a>.</p>
<p>The coding standards emphasize not reserving global resources.  The framework will not define functions or global constants, it uses <a href="http://www.procata.com/blog/archives/2004/05/24/exceptional-php/">exceptions</a> and doesn&#8217;t reserve __autoload for its own use.  This is very good.  On the other hand, it seems to rely on static methods quite a bit, which I think can burn you over the long run if you are trying to offer a componentized architecture and can make code more difficult to test.  I&#8217;ve been moving away from static methods as much as I can in my own code.  Eventually, I always seem to regret using them.  They lure you in at the beginning with the promise of simplicity and then they punish you later with their inflexibility.</p>
<p>I wonder how many of the components do their own &#8220;connection management&#8221; such as with the ZSearch::open (static methods again)?  This strikes me as an opportunity for a general dependency injection mechanism.  A technique that we are emphasizing more and more in WACT, but which I don&#8217;t think has reached widespread use in the PHP framework world.</p>
<p>One of the stated goals of the Zend Framework is to improve the PHP ecosystem.  The webcast suggests that Zend PHP Framework will play well with others, allowing you to use the components independently, or for example use a different templating system with the framework.  On the other hand, Andi suggested that all components will be distributed in their entirety.  When asked if a stripped down version could be distributed, the answer was &#8220;Why would you want to?&#8221;</p>
<p>I don&#8217;t think a monolithic distribution mechanism will play well with the new ecosystem of components that is rising up based on the PEAR installer&#8217;s new channel capability.  Eventually, the PEAR installer will move into the <a href="http://www.schlitt.info/applications/blog/index.php?/archives/388-Distributing-your-PHP-applications-with-PEAR.html">end user application installation</a> space.  To participate in this, ZPF should be available over a channel.  I think a key success factor for the Zend framework will be the release of individual components via a PEAR channel.</p>
<p>It is much better to be able to declare dependencies on individual packages, rather than on one huge bundle of components.  Monolithic distribution unnecessarily ties together the release schedules of packages that might otherwise have no common dependencies.  Micro-packages on a PEAR channel are the future of <a href="http://www.procata.com/blog/archives/2004/11/24/installing-web-applications/">PHP web application installation</a>.</p>
<p>Overall, I think Zend is taking a good approach to the development of ZPF.  I look forward to learning more.  </p>
<p><strong>Update</strong>: Just as writing tests is an important process element, because testable code is better code, I think that micro package releases are better than monolithic package releases from a process standpoint.  The mere act of writing the components so that they can be independently released highlights unhealthy dependencies.  This, of course, has to be tempered by an <a href="http://www.procata.com/blog/archives/2005/11/06/communicating-a-vision-with-open-source/">overall vision</a> and cross-package duplicate code elimination.  Two areas that have been challenges for PEAR with its political fiefdoms surrounding each package and one reason why <a href="http://www.procata.com/blog/archives/2005/12/01/the-rumors-of-pears-demise-are-greatly-exaggerated/">PEAR is not a framework</a>.</p>
<p>(P.S.  Hurry up and release ZSearch.  I want to use it.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/12/05/zend-framework-webcast/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>PEAR Channels</title>
		<link>http://www.procata.com/blog/archives/2005/03/07/pear-channels/</link>
		<comments>http://www.procata.com/blog/archives/2005/03/07/pear-channels/#comments</comments>
		<pubDate>Mon, 07 Mar 2005 22:08:07 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pear-installer]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/03/07/pear-channels/</guid>
		<description><![CDATA[I am very interested in the new  PEAR channels.  I like where this is going.  I especially like the idea of web application installers (versus library installers).
]]></description>
			<content:encoded><![CDATA[<p>I am very interested in the new  <a href="http://greg.chiaraquartet.net/categories/3-PEAR">PEAR channels</a>.  I like where <a href="http://www.robertpeake.com/archives/48-Getting-Pearified.html">this is going</a>.  I especially like the idea of <a href="http://www.procata.com/blog/archives/2004/11/24/installing-web-applications/">web application installers</a> (versus library installers).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/03/07/pear-channels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>pear config-set preferred_state beta</title>
		<link>http://www.procata.com/blog/archives/2004/11/24/pear-config-set-preferred_state-beta/</link>
		<comments>http://www.procata.com/blog/archives/2004/11/24/pear-config-set-preferred_state-beta/#comments</comments>
		<pubDate>Wed, 24 Nov 2004 07:21:43 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pear-installer]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/11/24/pear-config-set-preferred_state-beta/</guid>
		<description><![CDATA[I wish i could just do:
pear install Calendar beta
instead of:
pear config-set preferred_state beta
pear install Calendar
pear config-set preferred_state stable
]]></description>
			<content:encoded><![CDATA[<p>I wish i could just do:</p>
<p>pear install Calendar beta</p>
<p>instead of:</p>
<p>pear config-set preferred_state beta<br />
pear install Calendar<br />
pear config-set preferred_state stable</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/11/24/pear-config-set-preferred_state-beta/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PHP Coding Standards</title>
		<link>http://www.procata.com/blog/archives/2004/09/24/php-coding-standards/</link>
		<comments>http://www.procata.com/blog/archives/2004/09/24/php-coding-standards/#comments</comments>
		<pubDate>Fri, 24 Sep 2004 19:03:07 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[coding-standards]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/09/24/php-coding-standards/</guid>
		<description><![CDATA[I have to disagree with Paul Jones on coding standards:

The thing about defining a coding style standard is that there is no objective means by which to judge one style as â€œbetterâ€ or â€œmore-rightâ€ than another.

I can think of several objective criteria for judging coding standards practices off the top of my head:

Does the practice [...]]]></description>
			<content:encoded><![CDATA[<p>I have to disagree with Paul Jones <a href="http://paul-m-jones.com/blog/index.php?p=34">on coding standards</a>:</p>
<blockquote><p>
The thing about defining a coding style standard is that there is no objective means by which to judge one style as â€œbetterâ€ or â€œmore-rightâ€ than another.
</p></blockquote>
<p>I can think of several objective criteria for judging coding standards practices off the top of my head:</p>
<ul>
<li>Does the practice allow more code to be fit on the screen/page at one time (braces on the same line)</li>
<li>Does the code use white space to emphasize when things should be separate (spaces after commas)</li>
<li>Can the code written to the standard be viewed in multiple media and multiple editors (spaces not tabs, limited line lengths)</li>
<li>Does the practice conserve keystrokes (tabs not spaces, no spaces after commas <img src='http://www.procata.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</li>
<li>Does the practice facilitate copy and pasting (single statement of code per line)</li>
<li>Does the practice require extra work to maintain the code (java docs and formatted comment headers are harder to edit beceause of the prefix, aligning equals signs, etc)</li>
</ul>
<p>Obviously some practices can cause conflicts between criteria.  In this case, readability should triumph over key strokes.  Practices that require require editing unrelated lines during maintenance should be avoided.</p>
<p>One thing that I have found about refactoring is that no code smell is too small to fix.  Having your code in refactored normal form and the process of getting it there by performing small, seemingly unimportant refactorings can reveal the major refactorings that are really worth it.  Sometimes the major changes that need to be made are obscured by minor code smells.</p>
<p>Coding styles perform a similar function. Having your code in a &#8220;normalized&#8221; form frees the mind to consider other aspects of the code.  Poorly or inconsistently styled code can obscure refactorings.  With a good coding standard, the benefits outweigh having to re-train yourself out of a few habits.  I agree with Paul&#8217;s conclusion here.</p>
<p>Fortunately, the <a href="http://pear.sourceforge.net/en/standards.php">PEAR standards</a> has made the right decisions regarding these criteria with a couple of minor exceptions and many omissions.</p>
<p>The exceptions as I see them:</p>
<ul>
<li><a href="http://pear.sourceforge.net/en/standards.funcdef.php">aligning equal signs</a> should be discouraged.</li>
<li>The braces policy for <a href="http://pear.sourceforge.net/en/standards.funcdef.php">functions</a> should match that of <a href="http://pear.sourceforge.net/en/standards.control.php">control structures</a></li>
<li><a href="http://pear.sourceforge.net/en/standards.naming.php">embedding inheritance heirarchy into the class name</a> is bad</li>
</ul>
<p><strong>UPDATE:</strong> Looks I am not the only one who thinks <a href="http://blog.colorstudy.com/ianb/weblog/2004/09/22.html#P158">bad style is a bad smell</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/09/24/php-coding-standards/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>PEAR: Its a Vision Thing</title>
		<link>http://www.procata.com/blog/archives/2004/06/09/pear-its-a-vision-thing/</link>
		<comments>http://www.procata.com/blog/archives/2004/06/09/pear-its-a-vision-thing/#comments</comments>
		<pubDate>Wed, 09 Jun 2004 18:39:17 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/06/09/pear-its-a-vision-thing/</guid>
		<description><![CDATA[Alan Knowles has an update on the status of the template debate in PEAR.  Alan chose to highlight a post by Hans Lellelid.  I also had this message flagged for comment.  
Hans makes the argument for a tighter vision for PEAR, as well as for an overflow method for packages that don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Alan Knowles has an update on the <a href="http://blog.akbkhome.com/archives/39_A_Vision_for_PEAR.html">status of the template debate</a> in PEAR.  Alan chose to highlight a <a href="http://news.php.net/article.php?group=php.pear.dev&#038;article=30296">post by Hans Lellelid</a>.  I also had this message flagged for comment.  </p>
<p>Hans makes the argument for a tighter vision for PEAR, as well as for an overflow method for packages that don&#8217;t fit that vision.     </p>
<p>Alan asks if the PEAR group should veto this package? </p>
<p>Lukas Smith offers argument against package redundancy that I can sympathize with.</p>
<blockquote><p>Because PEAR commits to every package. Thats means if Alan gets run over, Paul dies of old age we are still commited to their packages. Even if they both never go away it still means that the QA team will have to deal with it. It also means that users will have to do alot of research instead of a bit. But I think we have agreed that redundant is bad David?</p></blockquote>
<p>I wonder if the idea of individual package ownership inhibits the development of a consistent PEAR vision?</p>
<p>I think a Savant veto without an alternate solution to the redundancy that already exists within PEAR will only reinforce the perception of special treatment for the first package on the block.</p>
<p>I think this is a very important debate for PEAR.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/06/09/pear-its-a-vision-thing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PEAR Templates</title>
		<link>http://www.procata.com/blog/archives/2004/06/04/pear-templates/</link>
		<comments>http://www.procata.com/blog/archives/2004/06/04/pear-templates/#comments</comments>
		<pubDate>Fri, 04 Jun 2004 15:13:33 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/06/04/pear-templates/</guid>
		<description><![CDATA[Aaron Wormus blogs on PEAR Template trouble.  The PEAR community seems to be having a significant debate over the proposal to include the template engine Savant into PEAR.
This proposal represents an identity crisis for PEAR.   Joshua Eichorn recognizes the issue:
Either we have 1 engine and multiple api&#8217;s and fix mistakes of the [...]]]></description>
			<content:encoded><![CDATA[<p>Aaron Wormus blogs on <a href="http://php.eckspee.com/archives/77_PEAR_Template_Trouble.html">PEAR Template trouble</a>.  The PEAR community seems to be having a significant debate over the <a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=83">proposal</a> to include the template engine <a href="http://phpsavant.com/">Savant</a> into PEAR.</p>
<p>This proposal represents an identity crisis for PEAR.   Joshua Eichorn recognizes the issue:</p>
<blockquote><p>Either we have 1 engine and multiple api&#8217;s and fix mistakes of the past or we allow competition, this double standard just doesn&#8217;t cut it.</p></blockquote>
<p>Lukas Smith recognizes the issue as well: </p>
<blockquote><p>So in conclusion if we accept yet another template engine API into PEAR we might as well forget what PEAR currently stands for.</p></blockquote>
<p>This proposal highlights the cognitive dissonance between the goal of having only one package for a purpose and the reality of already having multiple templating packages in PEAR. </p>
<p>Yet,  <a href="http://wact.sourceforge.net/index.php/TemplateView">there are many styles of templates</a> representing different viewpoints and needs.  Perhaps this is responsible for the amazing <a href="http://www.sitepointforums.com/showthread.php?threadid=123769">proliferation of template engines</a> in PHP.  Can PEAR hope to cover all of these needs with a one size fits all approach?  (or even a 5 sizes fit all approach)</p>
<p>Alan Knowles added some Savant features to Flexy and defends fortress PEAR:</p>
<blockquote><p>Flexy now does _everything_ that Savant does.. &#8211; you are basically proposing a competative package, that&#8217;s only competative feature, is realistically, that provide a marginally different API&#8230;</p></blockquote>
<p>But Paul Jones, the author of Savant responds by vowing to press forward with the political process:</p>
<blockquote><p>That is as it may be &#8230; however, I am going to continue the proposal and let it come to a vote.</p></blockquote>
<p>I do not know what this means in terms of PEARs political process.  If Savant wins its vote, does this mean that the doors to PEAR are open and that competition is allowed?  </p>
<p>Will there be a grand unification of PEAR template engines?  Or will the status quo be preserved, confirming the <a href="http://forums.devnetwork.net/viewtopic.php?p=93653#93653">landgrab theory</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/06/04/pear-templates/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Rephlux and PHP memory usage with a PEAR surpise</title>
		<link>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/</link>
		<comments>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/#comments</comments>
		<pubDate>Fri, 28 May 2004 02:37:56 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memory-usage]]></category>
		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/</guid>
		<description><![CDATA[Jon Ramsey came up with a continuous integration tool called Rephlux.  Rephlux periodically checks out your code from CVS and runs your unit tests on it.  It produces a RSS feed of test failures and a RSS feed of CVS revisions.  How cool is that?
In the future it should be possible to [...]]]></description>
			<content:encoded><![CDATA[<p>Jon Ramsey came up with a continuous integration tool called <a href="http://rephlux.sourceforge.net/">Rephlux</a>.  Rephlux periodically checks out your code from CVS and runs your unit tests on it.  It produces a <a href="http://wact.sourceforge.net/rephlux/wact.fails.xml">RSS feed of test failures</a> and a <a href="http://wact.sourceforge.net/rephlux/wact.revisions.xml">RSS feed of CVS revisions</a>.  How cool is that?</p>
<p>In the future it should be possible to automatically build releases and documentation when all the tests pass.  Hopefully, this will help improve our record of releasing on the <a href="http://wact.sourceforge.net/">WACT</a> project.  With one formal release in nearly a year of active development, our record is dismal as <a href="http://www.phppatterns.com/index.php/article/articleview/104/1/2/">Harry diplomatically points out</a>.</p>
<p>Jon is running Rephlux remotely for WACT right now because we are having a problem getting our full test suite to run in the 8M limit that sourceforge imposes on PHP.  We have 97 test cases, 541 test functions, and 1927 assertions in our test suite. This will only grow.  The full test suite includes over 350 PHP files when it runs.  </p>
<p>Since there isn&#8217;t much we can do about unincluding files to free up memory, I decided to take a look at the data that gets stored to see if there was any low hanging fruit there.  I wanted to look and see if any of the code we are using keeps any data in global variables that it might be able to release when done to allow the space to be garbage collected.</p>
<p>So, I added a quick and dirty little hack to get an idea of the size of the various global variables that were left over after a test run.<br />
<pre class="php">&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array_keys"><span style="color: #000066;">array_keys</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;$key=&quot;</span> . <a href="http://www.php.net/strlen"><span style="color: #000066;">strlen</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/serialize"><span style="color: #000066;">serialize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre><br />
Most of the globals that were left over were tiny, but there was one that stood out.  That was something from PEAR:<br />
<pre class="php">&nbsp;
_PEAR_destructor_object_list=<span style="color: #cc66cc;">146270</span>
&nbsp;</pre><br />
Looking in to this further I found that the PEAR base class registers a rather dubious destructor for every object that inherits from it:<br />
<pre class="php">&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> _PEAR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;_debug<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <a href="http://www.php.net/printf"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;PEAR destructor called, class=%sn&quot;</span>, <a href="http://www.php.net/get_class"><span style="color: #000066;">get_class</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre><br />
To support this gem, PEAR puts a reference to every object instance ever instantiated that inherits from <code>PEAR</code> into the global variable <code>_PEAR_destructor_object_list</code>.   There the object stays until the deconstruction shutdown function is called.  This reference prevents garbage collection of any of objects inheriting from <code>PEAR</code> or the memory they reference during the lifetime of the script.  And it does this for no good reason at all.</p>
<p>I&#8217;ve <a href="http://forums.devnetwork.net/viewtopic.php?p=90455#90455">expressed my opinion of <code>pear.php</code></a> before and this only reinforces it.  </p>
<p>The only PEAR module that WACT requires is <a href="http://pear.php.net/package/XML_HTMLSax"><code>XML_HTMLSax</code></a>, a handy parser for HTML with an XML parsing interface.  I&#8217;ve always been a little bit uncomfortable with its dependency on <code>pear.php</code> and the deployment issues that this introduces into WACT.  WACT also has optional components that reference other PEAR packages, such as PEAR::DB, PEAR::MDB and PEAR::MDB2.  Fortunately a more typical WACT use case only instantiates a handful of PEAR objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2004/05/27/rephlux-and-php-memory-usage/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

