FileFinder.php default path logic

Christof Meerwald via Phpwiki-talk <[email protected]> Sun, 21 Jan 2024 19:57:32 +0100
Newsgroups gmane.comp.web.wiki.phpwiki.talk
Message-ID <[email protected]>
--UDOkY98Txr+TTDfj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I don't think it makes sense to check if the member has already been
set in the constructor. And having the default argument "array()", but
then comparing against "false" means we never get into the then
branch. Patch is attached (so we only use the _get_include_path if
FileFinder has been called with no argument specified, which I think
is the intention here).


Christof

-- 

https://cmeerw.org                             sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org

--UDOkY98Txr+TTDfj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="filefinder.diff"

Index: lib/FileFinder.php
===================================================================
--- lib/FileFinder.php	(revision 11072)
+++ lib/FileFinder.php	(working copy)
@@ -42,9 +42,9 @@
     /**
      * @param array $path A list of directories in which to search for files.
      */
-    public function __construct($path = array())
+    public function __construct($path = false)
     {
-        if (!isset($this->_path) and $path === false) {
+        if ($path === false) {
             $path = $this->_get_include_path();
         }
         $this->_path = $path;

--UDOkY98Txr+TTDfj
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--UDOkY98Txr+TTDfj
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Phpwiki-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-talk

--UDOkY98Txr+TTDfj--