note 69836 added to function.base64-encode
| From: | php at ianco dot co dot uk | Date: | Fri, 22 Sep 2006 15:25:20 +0000 |
| Subject: | note 69836 added to function.base64-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117434@lists.php.net to get a copy of this message | ||
I am finding a length restriction with base64_encode (or possibly with echo) in PHP 4.3.9.
This works ok for me:
<?php
echo strlen(str_repeat('-', 3273)); // 3273
echo strlen(base64_encode(str_repeat('-', 3273))); // 4364
echo base64_encode(str_repeat('-', 3273)); // LS0t repeated
?>
But change the length to 3274 and the third echo prints nothing.
<?php
echo strlen(str_repeat('-', 3274)); // 3274
echo strlen(base64_encode(str_repeat('-', 3274))); // 4368
echo base64_encode(str_repeat('-', 3274)); // Nothing at all printed
?>
This has obvious implications if you're wanting to encode a fairly large serialized array and
echo it to a form field.
----
Server IP: 85.116.0.130
Probable Submitter: 84.92.139.196
----
Manual Page -- http://www.php.net/manual/en/function.base64-encode.php
Edit -- https://master.php.net/note/edit/69836
Del: integrated -- https://master.php.net/note/delete/69836/integrated
Del: useless -- https://master.php.net/note/delete/69836/useless
Del: bad code -- https://master.php.net/note/delete/69836/bad+code
Del: spam -- https://master.php.net/note/delete/69836/spam
Del: non-english -- https://master.php.net/note/delete/69836/non-english
Del: in docs -- https://master.php.net/note/delete/69836/in+docs
Del: other reasons-- https://master.php.net/note/delete/69836
Reject -- https://master.php.net/note/reject/69836
Search -- https://master.php.net/manage/user-notes.php