php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32473 base64_encode cuts text - input to 2933 Characters
Submitted: 2005-03-28 16:27 UTC Modified: 2005-03-29 20:46 UTC
From: f-bischof at versanet dot de Assigned:
Status: Closed Package: Apache related
PHP Version: PHP Version 4.3.11RC2-dev OS: Win XP Sp2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: f-bischof at versanet dot de
New email:
PHP Version: OS:

 

 [2005-03-28 16:27 UTC] f-bischof at versanet dot de
Description:
------------
I use Apache/1.3.31 (Win32) PHP/4.3.10 mod_ssl/2.8.18 OpenSSL/0.9.7d

I host a website: http://pocketwelt.dyndns.org

If someone writes a forum-article that is longer then
2933 Bytes and i try to save the input (base64_encoded)
in my database, and then reload the article, it?s
truncated after 2933 bytes. The rest deleted...

If i write the article without base64_encoding, i get 
so much characters in the databse like i want.

The Bug seems only appear if i use base64_encoding.
(also tested with PHP 5.05 with the same result...)



Reproduce code:
---------------
$text=base64_encode($text);

Text should be about 4 or 5 KB to see the bug !


Expected result:
----------------
Truncated Text afeter 2933 Bytes


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-29 18:11 UTC] f-bischof at versanet dot de
I have tried it with the announced latest stable version,
with the same result. Truncated after 2933 Bytes length.

http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
 [2005-03-29 20:26 UTC] f-bischof at versanet dot de
I have made some additionally tests, to write a workaround
for this problem !!! Instead of using base64_decode/encode
i have replaced all ' with '' in the $text - string to
avoid trouble with the sql-insert command. This showed me,
that the bug resists, even with not using base64_encode / decode functions.

If i insert a big $text - String in the database, the
database (MS-Access) stores this Text completely in
the Table. But if i select the Text out of the database
i got not the complete text like it is in the Database, 
its truncated after about 3KB. I think the problem is
in the mysql_odbc functions.

Here a code snipplet:
$connect = odbc_connect("astaBB","","");
$query = "SELECT NachrichtsID,User,Datum,TextN,Email from
Nachrichten,Login where NachrichtsID=$NachrichtsID and 
User='$username'";

# perform the query
$result = odbc_exec($connect, $query);
# fetch the data from the database
while(odbc_fetch_row($result))
	{
	$NachrichtsID=odbc_result($result, 1); 
	$User=odbc_result($result, 2); 
	$Datum=odbc_result($result, 3); 
	$Text=odbc_result($result, 4);
        $email=odbc_result($result, 5);
        }

$Text will be truncated after about 3KB, but the
Table-Field TextN (Access-Memo Field) has the
complete 4KB Text stored.
 [2005-03-29 20:46 UTC] f-bischof at versanet dot de
Sorry, i am stupid !!!!!!

Changing the value of the odbc.defaultlrl in the 
php.ini to:

odbc.defaultlrl = 300000

...fixed my problem... Ouch.....
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC