From: Brion Vibber Date: Sat, 24 Jun 2006 07:04:53 +0000 (+0000) Subject: * Fix notice in MacBinary detection debug data for files of certain lengths X-Git-Tag: 1.31.0-rc.0~56640 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=d37e0b6ecddc31476f44ddb5f32d40431bc7b5d3;p=lhc%2Fweb%2Fwiklou.git * Fix notice in MacBinary detection debug data for files of certain lengths --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0855b574b2..7807ed2cc1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -547,6 +547,8 @@ Some default configuration options have changed: * (bug 2316) Add "caption" attribute to tag * Allow setting the skin object that ImageGallery will use; needed during parse operations (the skin must come from the ParserOptions, not $wgUser) +* Fix notice in MacBinary detection debug data for files of certain lengths + == Compatibility == diff --git a/includes/MacBinary.php b/includes/MacBinary.php index ad8fe4b50e..05c3ce5cfd 100644 --- a/includes/MacBinary.php +++ b/includes/MacBinary.php @@ -254,13 +254,16 @@ class MacBinary { for( $remaining = strlen( $data ); $remaining > 0; $remaining -= $width ) { $line = sprintf( "%04x:", $at ); $printable = ''; - for( $i = 0; $i < $width; $i++ ) { + for( $i = 0; $i < $width && $remaining - $i > 0; $i++ ) { $byte = ord( $data{$at++} ); $line .= sprintf( " %02x", $byte ); $printable .= ($byte >= 32 && $byte <= 126 ) ? chr( $byte ) : '.'; } + if( $i < $width ) { + $line .= str_repeat( ' ', $width - $i ); + } wfDebug( "MacBinary: $line $printable\n" ); } }