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

Bug #16240 Referencing array in place of string in xdiff.php
Submitted: 2009-05-19 20:39 UTC
From: hrabbit Assigned: yunosh
Status: Closed Package: Text_Diff (version 1.1.0)
PHP Version: 5.2.4 OS: Ubuntu 8.04
Roadmaps: (Not assigned)    
Subscription  


 [2009-05-19 20:39 UTC] hrabbit (Scott Horsley)
Description: ------------ Accoding to Text/Diff/Engine/xdiff.php line 45 states that it is looking for an array item of 0 $line[0]. Unfortunetly the content of line is actually a string at this point. The change outlined below explains what I needed to do in order to get the switch working as expected. $ diff xdiff.php /usr/share/php/Text/Diff/Engine/xdiff.php 45c45 < switch ($line[0])) { --- > switch (substr($line, 0, 1)) { Please excuse my lack of bug reporting skills. Test script: --------------- <?php $diff = array('foo', 'bar', 'baz'); foreach ($diff as $line) { switch ($line[0]) { case ' foo': break; } } ?> Actual result: -------------- /usr/share/php/Text/Diff/Engine/xdiff.php [47]: Uninitialized string offset: 0

Comments

 [2009-05-19 20:41 UTC] hrabbit (Scott Horsley)
The following patch has been added/updated: Patch Name: bugfix-16240.patch Revision: 1242747673 URL: http://pear.php.net/bugs/patch-display.php?bug=16240&patch=bugfix-16240.patch&revision=1242747673&display=1
 [2009-05-19 20:44 UTC] hrabbit (Scott Horsley)
-Summary: Incorrect reference when accessing a string +Summary: Referencing array in place of string in xdiff.php
Corrected summary.
 [2009-05-21 19:30 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: yunosh
Thanks for the patch Scott!
 [2009-07-24 18:27 UTC] yunosh (Jan Schneider)
-Status: Assigned +Status: Bogus
Thank you for taking the time to write to us, but this is not a bug. There is nothing wrong with that.
 [2009-07-24 18:31 UTC] yunosh (Jan Schneider)
-Status: Bogus +Status: Assigned
Ah, I didn't see the full report. The warning shouldn't happen of course.
 [2009-07-24 19:00 UTC] yunosh (Jan Schneider)
-Status: Assigned +Status: Closed
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.