Doc #68930 [Opn->Nab]: Completely wrong example in comments
| From: | mazzanet@php.net | Date: | Thu, 29 Jan 2015 02:10:25 +0000 |
| Subject: | Doc #68930 [Opn->Nab]: Completely wrong example in comments | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11895@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68930&edit=1
ID: 68930
Updated by: mazzanet@php.net
Reported by: vlajos at gmail dot com
Summary: Completely wrong example in comments
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Not a bug.
User notes have vote up and vote down buttons which you can use to show other users of a note's
value. You could also write your own note explaining these issues for other user's reference.
Previous Comments:
------------------------------------------------------------------------
[2015-01-28 10:21:23] vlajos at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=68930&edit=1