Skip to content

Commit

Permalink
THIS is the correct logging fix :)
Browse files Browse the repository at this point in the history
We are logging the id, which is contained in the first $id_len bytes of
the data.
  • Loading branch information
mrubinsk committed Jan 21, 2015
1 parent 2c21ae9 commit 3bc6d99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/Compress/lib/Horde/Compress/Tnef.php
Expand Up @@ -325,8 +325,8 @@ protected function _extractMapiAttributes($data)
$data_len = $id_len + ((4 - ($id_len % 4)) % 4);
$this->_logger->debug(sprintf(
'TNEF: Named Id: %s',
substr($this->_getx($data, $data_len), $id_len)
));
substr($this->_getx($data, $data_len)), 0, $id_len)
);
break;

default:
Expand Down

2 comments on commit 3bc6d99

@acmpires
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is the correct fix :)

@@ -332,8 +332,8 @@ class Horde_Compress_Tnef extends Horde_Compress_Base
                     $data_len = $id_len + ((4 - ($id_len % 4)) % 4);
                     $this->_logger->debug(sprintf(
                         'TNEF: Named String Id: %s',
-                        substr($this->_getx($data, $data_len)), 0, $id_len)
-                    );
+                        substr($this->_getx($data, $data_len), 0, $id_len)
+                    ));
                     break;

                 default:

Without this fix the code will throw this error:

PHP ERROR: substr() expects at least 2 parameters, 1 given

@mrubinsk
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit that won't go away ;)

I'm currently refactoring a bunch of stuff in there right now, and already caught this, but thanks!

Please sign in to comment.