Re: Re: cvs: php-src /pear/PEAR Common.php
| From: | Jon Parise | Date: | Sat, 01 May 2004 20:17:15 +0000 |
| Subject: | Re: Re: cvs: php-src /pear/PEAR Common.php | ||
| References: | 1 2 3 | Groups: | php.pear.cvs php.pear.core |
| Request: | Send a blank email to pear-cvs+get-19090@lists.php.net to get a copy of this message | ||
On Fri, Apr 30, 2004 at 10:43:00PM -0400, Greg Beaver wrote:
> >>@@ -1235,7 +1235,10 @@
> >> function buildProvidesArray($srcinfo)
> >> {
> >> $file = basename($srcinfo['source_file']);
> >>- $pn = $this->_packageName;
> >>+ $pn = '';
> >>+ if (isset($this->_packageName)) {
> >>+ $pn = $this->_packageName;
> >>+ }
> >> $pnl = strlen($pn);
> >> foreach ($srcinfo['declared_classes'] as $class) {
> >> $key = "class;$class";
> >
> >Because you're initializing $pn to an empty string here, a !empty()
> >test might be more appropriate.
>
> but the test is of $this->_packageName, not $pn, the $pn = '' is to
> remove a warning if buildProvidesArray() is called with no call to
> validatePackageFile(). The notice was because $_packageName was not set.
Right, I agree with that. My point is that $pn is being initialized
to ''. If $this->_packageName is equal to '', $pn will be needlessly
assigned to its initialized value.
I retract comment, though, because this rules out setting $pn to
'false' or 0 (even though those values are probably invalid).
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)