Edit report at https://bugs.php.net/bug.php?id=77284&edit=1
ID: 77284
Comment by: anubas at hotmail dot com
Reported by: anubas at hotmail dot com
Summary: base64
Status: Feedback
Type: Bug
Package: *URL Functions
Operating System: FreeBSD 11.2-RELEASE-p5
PHP Version: 7.3.0
Block user comment: N
Private report: N
New Comment:
The following code:
<?php
$x = 'This is a string';
$y = base64_encode($x);
$z = base64_decode($y);
var_dump($x) . '<br />';
var_dump($y) . '<br />';
var_dump($z) . '<br />';
Produces:
string(16) "This is a string"
string(-6072743447921604100) "
2018/12/11 13:24:05 [error] 91715#100408: *63 FastCGI sent in stderr: "PHP message: PHP Fatal
error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12374000625787949056
bytes) in [FILE] on line 8" while reading response header from upstream, client: [IP], server:
[SERVER], request: "GET /[FILE] HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000",
host: "[SERVER]"
It appears the output from base64_encode() is invalid.
Previous Comments:
------------------------------------------------------------------------
[2018-12-11 21:17:03] anubas at hotmail dot com
This worked fine on PHP 7.2.12 on the same server. The only thing that has changed is the version of
PHP that I am using.
------------------------------------------------------------------------
[2018-12-11 20:53:15] danack@php.net
I can't reproduce the bug: https://3v4l.org/omfrZ
This is going to be a problem either with your system, or some other problem we can't help
with.
Please feel free to update this with a reproducible case.
------------------------------------------------------------------------
[2018-12-11 20:44:20] anubas at hotmail dot com
Description:
------------
Problem: $x != $z in the test script below.
Test script:
---------------
<?php
$x = 'This is a string';
$y = base64_encode($x);
$z = base64_decode($y);
if ($x != $z) {
print 'base64 encoding/decoding broken';
}
Expected result:
----------------
$x == $z
Actual result:
--------------
$x != $z
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77284&edit=1