Doc #68930 [NEW]: Completely wrong example in comments
| From: | vlajos at gmail dot com | Date: | Wed, 28 Jan 2015 10:21:24 +0000 |
| Subject: | Doc #68930 [NEW]: Completely wrong example in comments | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-11893@lists.php.net to get a copy of this message | ||
From: vlajos at gmail dot com
Operating system: any
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Completely wrong example in comments
Description:
------------
---
From manual page: http://www.php.net/ref.mcrypt
---
This comment has several issues:
http://php.net/manual/en/ref.mcrypt.php#99263
1.
This code snippet can strip the trailing characters when decrypting if
they match with the padding character.
It shouldn't strip more characters when decrypting than
ord(substr($dec, strlen($dec)-1,1))
Because otherwise it removes the additional characters from the
original
string. (If they match accidentally.)
2.
The IV is completely useless here:
The IV is ignored in ECB mode as this mode does not require it. You
will
need to have the same IV (think: starting point) both at encryption and
decryption stages, otherwise your encryption will fail.
The first point can lead corruptions, so I suggest to remove this
comment. (I send an email already to the original author a few days
ago.)
--
Edit bug report at https://bugs.php.net/bug.php?id=68930&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68930&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68930&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68930&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68930&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68930&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68930&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68930&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68930&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68930&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68930&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68930&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68930&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68930&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68930&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68930&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68930&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68930&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68930&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68930&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68930&r=mysqlcfg