Apache Version: 1.3.27
Operating System: Windows XP SP1
PHP Version: 4.3.2

PHP runs as a module for apache.

Basically, I've created my own module for reading bitmaps under windows.
The module creates a gd object, and reads the pixels from a bitmap to
the gd object.

This module worked fine before PHP4.3.2 (at least it worked in 4.3.2's
RCs), but it seems to have stopped working in PHP4.3.2's release.

What I did was I removed all of the code for creating the bitmap itself,
and was left with the image creating code.

What I found was, that when the image was either destroyed, or unloaded,
Apache Crashed ( presumably segmentation fault ).

As far as I can tell, I use exactly the same code as the gd module for
creating an image.

I have included the code I use for my readbitmap function. I have tested
le_gd and it is the correct value.

I'm afraid I cannot provide a backtrace because this is a windows
system, and I am unfamilier with generating a backtrace on a windows
system, and I could not see instruction on how to do it.

I tried compiling my module in debug mode, but when given the chance to
debug when it crashed - I was given the ASM for apache, seeing as it was
apache.exe that actually crashed, and apache was not compiled in debug

I have also tried gdImageDestroy'ing (im) as soon as it is created and
returning false. This does not cause any problems.

In the source below you can see im = readbitmaptogdimage(). This is the
function that reads the bitmap, but it turns out that if I just use
gdImageCreateTrueColor, when that is unloaded, apache crashes.

If you can think of anything that might cause it, or any way around the
problem, it would be appreciated.

An alternative would be to write one function to get the size from a
bitmap, create the image using php, and use another function to copy a
bitmap to the image. If I try that, I'll reply to this bug report, but
that should work, because the problem seems to be related to unloading
resources created with a module.

I've written other modules that just manipulate gd resources (no
resource creation), and they still work fine for PHP4.3.2.

Thanks in Advance for any help.

Reproduce code:
gdImagePtr im;
zval **file;

if ( zend_get_parameters_ex( 1, &file ) == FAILURE )

//im = readbitmaptogdimage( Z_STRVAL_PP(file) );

im = gdImageCreateTrueColor( 100, 100 );

if ( !im ) RETURN_FALSE;

ZEND_REGISTER_RESOURCE( return_value, im, le_gd );

Expected result:
A GD object to be created and registered as a resource

Actual result:
A GD object is created, but when an attempt is made to unload it (or
when PHP finishes executing and does its resource cleanup), it crashes.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
postedJun 15, '03 at 5:23p
activeJun 15, '03 at 5:23p

1 user in discussion

Iridium: 1 post



site design / logo © 2022 Grokbase