php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33327 imagecreatefromstring chokes on input when using Apache 1.3 module
Submitted: 2005-06-13 21:25 UTC Modified: 2005-06-14 01:18 UTC
From: pillepop2003 at yahoo dot de Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
 [2005-06-13 21:25 UTC] pillepop2003 at yahoo dot de
Description:
------------
I am using PHP on Apache/1.3.29 (Unix).

The script behaves differently, depeding on PHP running as cgi or as apache-module, in the following way:

- load jpeg into string
- save base64_encode(string) with file_put_contents() as dummy.txt
- load dummy.txt into string with file_get_contents()
- decode string with base64_decode()
- process loaded string with imagecreatefromstring()

The Script behaves fine when using php as cgi.
The script stops without any warning or response when using php as apache-module after imagecreatefromstring().

Everything works fine without base64-encoding/decoding.

(I'm using file_put_contents from Pear::compat)
GD Version: 2.0 or higher

Reproduce code:
---------------
$data = file_get_contents('test.jpg');

file_put_contents('dummy.txt', base64_encode($data));
$data = base64_decode(file_get_contents('dummy.txt'));

$im = imagecreatefromstring($data);

echo 'helloworld';

Expected result:
----------------
output of "helloworld" with either cgi or apache-module

Actual result:
--------------
cgi-version: output 'helloworld'
apache-module: script terminates silenty after imagecreatefromstring()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-13 22:19 UTC] pillepop2003 at yahoo dot de
It also doesnt work if i leave out the decode/encode:

$data = file_get_contents('test.jpg');
$im = imagecreatefromjpeg($data);

...terminates after imagecreatefromjpeg, silently.
 [2005-06-13 23:37 UTC] pillepop2003 at yahoo dot de
I'm on a managed server, so I'm afraid I cannot install a snapshot. Did you solve the problem in the current cvs?
btw: it perfectly works on my win32 / php 4.3.11 box.

IMHO the problem is caused by imagecreatefromstring() not being able to deal with the file_get_contents() string.
 [2005-06-13 23:40 UTC] sniper@php.net
Please don't report bugs to old PHP versions if you've already even checked that it WORKS with new version!!!!

 [2005-06-14 00:30 UTC] pillepop2003 at yahoo dot de
I did say it works on my win-box, but that does not apply for the linux version, as i caanot test it there. furthermore, i don't see any relevant changelog entry from 4.3.10 to 4.3.11 that could have fixed this problem.
it's up to you to decide whether to close this bug or not, but you should make sure, this problem does not apply to linus 4.3.11
 [2005-06-14 01:18 UTC] sniper@php.net
I can not reproduce it with PHP 4.4.0-dev (under linux).
Please don't reopen this anymore.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 21:00:01 2025 UTC