note 107979 added to function.mdecrypt-generic
| From: | PeterBailey | Date: | Mon, 19 Mar 2012 17:49:32 +0000 |
| Subject: | note 107979 added to function.mdecrypt-generic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186736@lists.php.net to get a copy of this message | ||
We found that sometimes the resulting padding is not null characters "\0" but rather one
of several control characters.
If you know your data is not supposed to have any trailing control characters "as we did"
you can strip them like so.
<?php
$data = mdecrypt_generic( $cipher, $data );
// Strip trailing control-character padding
$data = preg_replace( "/\p{Cc}*$/u", "", $data );
?>
----
Server IP: 64.71.164.2
Probable Submitter: 12.151.187.1
----
Manual Page -- http://www.php.net/manual/en/function.mdecrypt-generic.php
Edit -- https://master.php.net/note/edit/107979
Del: integrated -- https://master.php.net/note/delete/107979/integrated
Del: useless -- https://master.php.net/note/delete/107979/useless
Del: bad code -- https://master.php.net/note/delete/107979/bad+code
Del: spam -- https://master.php.net/note/delete/107979/spam
Del: non-english -- https://master.php.net/note/delete/107979/non-english
Del: in docs -- https://master.php.net/note/delete/107979/in+docs
Del: other reasons-- https://master.php.net/note/delete/107979
Reject -- https://master.php.net/note/reject/107979
Search -- https://master.php.net/manage/user-notes.php