Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.4

Bug #14892 Notice: Array to string conversion in /home/clockwerx/pear/File_SearchReplace/S
Submitted: 2008-10-27 01:28 UTC Modified: 2008-10-31 13:05 UTC
From: doconnor Assigned: doconnor
Status: Closed Package: File_SearchReplace (version CVS)
PHP Version: 5.2.4 OS:
Roadmaps: (Not assigned)    
Subscription  



Patch fix-tests Revisions
Revision 2008-10-27 06:35 UTC
Developer doconnor
 
Download patch

? php5.diff.txt
? run-tests.log
? tests/04normal_bof.diff
? tests/04normal_bof.exp
? tests/04normal_bof.log
? tests/04normal_bof.out
? tests/04normal_bof.php
Index: SearchReplace.php
===================================================================
RCS file: /repository/pear/File_SearchReplace/SearchReplace.php,v
retrieving revision 1.15
diff -u -r1.15 SearchReplace.php
--- SearchReplace.php	25 Mar 2007 18:51:59 -0000	1.15
+++ SearchReplace.php	27 Oct 2008 06:34:49 -0000
@@ -261,16 +261,18 @@
         $occurences = 0;
         $file_array = file($filename);
 
+        // just for the sake of catching occurences
+        $local_find    = array_values((array) $this->find);
+        $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
         if (empty($this->ignore_lines) && $this->php5) { // PHP5 acceleration
-            $file_array = str_replace($this->find, $this->replace, $file_array, $occurences);
+            $file_array = str_replace($local_find, $local_replace, $file_array, $occurences);
 
         } else { // str_replace() doesn't return number of occurences in PHP4
                  // so we need to count them manually and/or filter strings
             $ignore_lines_num = count($this->ignore_lines);
 
-            // just for the sake of catching occurences
-            $local_find    = array_values((array) $this->find);
-            $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
 
             for ($i=0; $i < count($file_array); $i++) {