#44237 [Com]: mbstring.func_overload

2008-02-25 Thread baco at infomaniak dot ch
 ID:   44237
 Comment by:   baco at infomaniak dot ch
 Reported By:  lip at lip dot net dot ua
 Status:   Open
 Bug Type: Apache2 related
 Operating System: Debian 4.0
 PHP Version:  5.2.5
 New Comment:

As workaround try to force mbstring.func_overload = 0 in your php.ini
and use this patch.

PHP5

unix_mbstring_func_overload.patch
--- ext/mbstring/mbstring.c 2007-09-24 13:51:36.0 +0200
+++ ext/mbstring/mbstring.c 2007-12-04 18:00:10.023564681 +0100
@@ -765,8 +765,8 @@
 PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, 
OnUpdate_mbstring_script_encoding)
 #endif /* ZEND_MULTIBYTE */
 PHP_INI_ENTRY(mbstring.substitute_character, NULL, 
PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
-STD_PHP_INI_ENTRY(mbstring.func_overload, 0, 
PHP_INI_SYSTEM |
-PHP_INI_PERDIR, OnUpdateLong, func_overload, 
zend_mbstring_globals, mbstring_globals)
+STD_PHP_INI_ENTRY(mbstring.func_overload, 0,
+PHP_INI_SYSTEM, OnUpdateLong, func_overload, 
zend_mbstring_globals, mbstring_globals)

 STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0,
 PHP_INI_SYSTEM | PHP_INI_PERDIR, 
OnUpdate_mbstring_encoding_translation,

PHP4

--- ext/mbstring/mbstring.c 2007-04-04 17:28:18.0 +0200
+++ ext/mbstring/mbstring.c 2007-12-04 18:05:29.363559316 +0100
@@ -815,8 +815,8 @@
 PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, 
OnUpdate_mbstring_script_encoding)
 #endif /* ZEND_MULTIBYTE */
 PHP_INI_ENTRY(mbstring.substitute_character, NULL, 
PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
-STD_PHP_INI_ENTRY(mbstring.func_overload, 0, 
PHP_INI_SYSTEM |
-PHP_INI_PERDIR, OnUpdateInt, func_overload, 
zend_mbstring_globals, mbstring_globals)
+STD_PHP_INI_ENTRY(mbstring.func_overload, 0,
+PHP_INI_SYSTEM, OnUpdateInt, func_overload, 
zend_mbstring_globals, mbstring_globals)

 STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0,
 PHP_INI_SYSTEM | PHP_INI_PERDIR, 
OnUpdate_mbstring_encoding_translation,


Previous Comments:


[2008-02-24 22:23:08] lip at lip dot net dot ua

Expected result:

php1.net - Warning:  mb_ereg() function.mb-ereg: mbregex compile err:
premature end of char-class in /var/www/php2/mb.php

php2.net - galaD

Actual result:
--
php1.net - Warning
php2.net - Warning



[2008-02-24 22:03:13] lip at lip dot net dot ua

Description:

PHP 5.2.5
Apache/2.2.8

If I use mbstring.func_overload in .htaccess 
other virtual-host doesn't work.

For example:
VirtualHost *:80
DocumentRoot /var/www/php1
ServerName php1.net
/VirtualHost

VirtualHost *:80
DocumentRoot /var/www/php2
ServerName php2.net
/VirtualHost

in /var/www/php1/.htaccess
php_value mbstring.func_overload 6

In this situation php2.net/mb.php doesn't work when I refresh few
times php1.net/mb.php and php2.net/mb.php



Reproduce code:
---
--mb.php---
?php
$re0 = '(^|()+|[^\])';
$dbname_to_test = 'galaD';

if  (ereg($re0,$dbname_to_test))
{
var_dump ($dbname_to_test);
}
?

Expected result:

galaD

Actual result:
--
Warning:  mb_ereg() function.mb-ereg: mbregex compile err: premature
end of char-class in /var/www/php2/mb.php





-- 
Edit this bug report at http://bugs.php.net/?id=44237edit=1


#43227 [Opn]: eregi() mbregex compile err: premature end of regular expression in

2008-02-25 Thread baco at infomaniak dot ch
 ID:   43227
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Open
 Bug Type: mbstring related
 Operating System: Linux Debian
 PHP Version:  4.4.7
 New Comment:

As workaround try to force mbstring.func_overload = 0 in your php.ini
and use this patch.

PHP5

unix_mbstring_func_overload.patch
--- ext/mbstring/mbstring.c 2007-09-24 13:51:36.0 +0200
+++ ext/mbstring/mbstring.c 2007-12-04 18:00:10.023564681 +0100
@@ -765,8 +765,8 @@
 PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, 
OnUpdate_mbstring_script_encoding)
 #endif /* ZEND_MULTIBYTE */
 PHP_INI_ENTRY(mbstring.substitute_character, NULL, 
PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
-STD_PHP_INI_ENTRY(mbstring.func_overload, 0, 
PHP_INI_SYSTEM |
-PHP_INI_PERDIR, OnUpdateLong, func_overload, 
zend_mbstring_globals, mbstring_globals)
+STD_PHP_INI_ENTRY(mbstring.func_overload, 0,
+PHP_INI_SYSTEM, OnUpdateLong, func_overload, 
zend_mbstring_globals, mbstring_globals)

 STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0,
 PHP_INI_SYSTEM | PHP_INI_PERDIR, 
OnUpdate_mbstring_encoding_translation,

PHP4

--- ext/mbstring/mbstring.c 2007-04-04 17:28:18.0 +0200
+++ ext/mbstring/mbstring.c 2007-12-04 18:05:29.363559316 +0100
@@ -815,8 +815,8 @@
 PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, 
OnUpdate_mbstring_script_encoding)
 #endif /* ZEND_MULTIBYTE */
 PHP_INI_ENTRY(mbstring.substitute_character, NULL, 
PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
-STD_PHP_INI_ENTRY(mbstring.func_overload, 0, 
PHP_INI_SYSTEM |
-PHP_INI_PERDIR, OnUpdateInt, func_overload, 
zend_mbstring_globals, mbstring_globals)
+STD_PHP_INI_ENTRY(mbstring.func_overload, 0,
+PHP_INI_SYSTEM, OnUpdateInt, func_overload, 
zend_mbstring_globals, mbstring_globals)

 STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0,
 PHP_INI_SYSTEM | PHP_INI_PERDIR, 
OnUpdate_mbstring_encoding_translation,


Previous Comments:


[2008-02-25 13:18:00] lip at lip dot net dot ua

I think these bugs are similar.
http://bugs.php.net/bug.php?id=44237



[2007-11-09 16:03:14] baco at infomaniak dot ch

Description:

eregi() produce random errors like function.mb-eregi: mbregex compile
err: premature end of regular expression in when used with special
chars like accents.

N.B. On the web you can found a lot of reports of this issue. Some post
suggests forcing mbstring.func_overload = 0 but it doesn't work for me.

If Apache1 is restarted the error doesn't come anymore before an amount
of time and request.

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
ok

...


Reproduce code:
---
?php
if (eregi(cité, electricité)) {
echo ok\n;
}
?

Expected result:

OK

Actual result:
--
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /





-- 
Edit this bug report at http://bugs.php.net/?id=43227edit=1


#43227 [NEW]: eregi() mbregex compile err: premature end of regular expression in

2007-11-09 Thread baco at infomaniak dot ch
From: baco at infomaniak dot ch
Operating system: Linux Debian
PHP version:  4.4.7
PHP Bug Type: mbstring related
Bug description:  eregi() mbregex compile err: premature end of regular 
expression in

Description:

eregi() produce random errors like function.mb-eregi: mbregex compile
err: premature end of regular expression in when used with special chars
like accents.

N.B. On the web you can found a lot of reports of this issue. Some post
suggests forcing mbstring.func_overload = 0 but it doesn't work for me.

If Apache1 is restarted the error doesn't come anymore before an amount of
time and request.

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

$ GET http://localhost/test.php
ok

$ GET http://localhost/test.php
ok

...


Reproduce code:
---
?php
if (eregi(cité, electricité)) {
echo ok\n;
}
?

Expected result:

OK

Actual result:
--
br /
bWarning/b:  mb_eregi() [a
href='function.mb-eregi'function.mb-eregi/a]: mbregex compile err:
premature end of regular expression in
b/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php/b on line
b2/bbr /

-- 
Edit bug report at http://bugs.php.net/?id=43227edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43227r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43227r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43227r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43227r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43227r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=43227r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=43227r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=43227r=needscript
Try newer version:http://bugs.php.net/fix.php?id=43227r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=43227r=support
Expected behavior:http://bugs.php.net/fix.php?id=43227r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=43227r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=43227r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43227r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43227r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43227r=dst
IIS Stability:http://bugs.php.net/fix.php?id=43227r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=43227r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43227r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=43227r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=43227r=mysqlcfg


#42416 [WFx]: Apache2 locked imagecreate with imagettftext

2007-08-27 Thread baco at infomaniak dot ch
 ID:   42416
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Wont fix
 Bug Type: GD related
 Operating System: Linux
 PHP Version:  4.4.7
 Assigned To:  pajoye
 New Comment:

The PHP development team hereby announces that support for PHP 4 
will continue until the end of this year only. 

So you need to supported PHP 4 users community until the end of this 
year right ?

I have fixed this bug by backporting mutex changes in gd from 5.2.3 
to 4.4.7. No more Apache2 locks.

Please include my patch in snap 4.4-dev so it can be included the 
next 4.4.8 and change the ticket status to Fixed...

http://www.infomaniak.ch/php4/unix_gd_mutex.patch

Best Regards,
Guy Baconniere

Reproduce code:
---

$crash = 1;
$text = 'Bug';
$font = $_SERVER['DOCUMENT_ROOT'] . '/fonts' .'/'. 'arial.ttf';

if ($crash == 1) {
$image = imagecreate(64, 32);
} else {
$image = imagecreatetruecolor(64, 32);
}

$bg = imagecolorallocate($image, 0, 0, 0);
$fg = imagecolorallocate($image, 255, 255, 255);

/* LOCK APACHE2 PROCESS AFTER THIS POINT IF crash == 1
 * = if imagecreate() used but not if imagecreatetruecolor()
 */
imagettftext($image, 20, 0, 8, 24, $fg, $font, $text);

header('Content-type: image/png');
imagepng($image);

imagedestroy($image);

Proposed patch:
---
--- ext/gd/config.m42007-03-10 14:06:37.0 +0100
+++ ext/gd/config.m42007-08-27 13:39:51.554453976 +0200
@@ -259,6 +259,7 @@
   PHP_CHECK_LIBRARY(gd, gdCacheCreate,  
[AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
   PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown,
[AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
   PHP_CHECK_LIBRARY(gd, gdFreeFontCache,
[AC_DEFINE(HAVE_GD_FREEFONTCACHE,1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
+  PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup,  
[AC_DEFINE(HAVE_GD_FONTMUTEX,1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
   PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx,  
[AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
 ])

--- ext/gd/gd.c 2007-01-01 10:46:42.0 +0100
+++ ext/gd/gd.c 2007-08-27 13:42:53.257809726 +0200
@@ -333,6 +328,7 @@
 #if HAVE_LIBT1
T1_CloseLib();
 #endif
+   gdFontCacheMutexShutdown();
return SUCCESS;
 }
 /* }}} */
@@ -344,6 +349,7 @@
 {
le_gd = zend_register_list_destructors_ex(php_free_gd_image, 
NULL, gd, module_number);
le_gd_font = 
zend_register_list_destructors_ex(php_free_gd_font, NULL, gd font, 
module_number);
+   gdFontCacheMutexSetup();
 #if HAVE_LIBT1
T1_SetBitmapPad(8);
T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | 
IGNORE_FONTDATABASE);
--- ext/gd/libgd/gd.h   2004-07-23 01:09:24.0 +0200
+++ ext/gd/libgd/gd.h   2007-08-27 13:15:04.953547226 +0200
@@ -295,6 +295,14 @@
 void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, 
unsigned short *s, int color);
 void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, 
unsigned short *s, int color);

+/*
+ * The following functions are required to be called prior to the
+ * use of any sort of threads in a module load / shutdown function
+ * respectively.
+ */
+void gdFontCacheMutexSetup();
+void gdFontCacheMutexShutdown();
+
 /* 2.0.16: for thread-safe use of gdImageStringFT and friends,
  * call this before allowing any thread to call gdImageStringFT.
  * Otherwise it is invoked by the first thread to invoke
--- ext/gd/libgd/gdft.c 2007-03-10 13:51:07.0 +0100
+++ ext/gd/libgd/gdft.c 2007-08-27 13:14:35.995737476 +0200
@@ -750,10 +750,8 @@
  /* find antialised color */

  tc_key.bgcolor = *pixel;
- gdMutexLock(gdFontCacheMutex);
  tc_elem = (tweencolor_t *) gdCacheGet (tc_cache, 
tc_key);
  *pixel = tc_elem-tweencolor;
- gdMutexUnlock(gdFontCacheMutex);
}
}
}
@@ -771,30 +769,39 @@

 void gdFontCacheShutdown()
 {
+   gdMutexLock(gdFontCacheMutex);
+
if (fontCache) {
-   gdMutexLock(gdFontCacheMutex);
gdCacheDelete(fontCache);
fontCache = NULL;
-   gdMutexUnlock(gdFontCacheMutex);
-   gdMutexShutdown(gdFontCacheMutex);
FT_Done_FreeType(library);
}
+
+   gdMutexUnlock(gdFontCacheMutex);
 }

 void gdFreeFontCache()
 {
gdFontCacheShutdown();
 }
-
+
+void gdFontCacheMutexSetup()
+{
+   gdMutexSetup(gdFontCacheMutex);
+}
+
+void gdFontCacheMutexShutdown()
+{
+   gdMutexShutdown(gdFontCacheMutex);
+}
+
 int gdFontCacheSetup(void)
 {
if (fontCache) {
/* Already set up */
return 0;
}
-   gdMutexSetup(gdFontCacheMutex

#42416 [WFx]: Apache2 locked imagecreate with imagettftext

2007-08-27 Thread baco at infomaniak dot ch
 ID:   42416
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Wont fix
 Bug Type: GD related
 Operating System: Linux
 PHP Version:  4.4.7
 Assigned To:  pajoye
 New Comment:

Yes, our customers are using both freetype 
1.x and 2.x calls. We can't stop support
old calls.

If you disable both --with-ttf and 
--enable-gd-native-ttf apache2 are also
locked by calling imagefttext() when
imagecreate() is used.

We are a web hosting provider and some of our 
customers are using PHP scripts who are not 
(yet) compatible with PHP 5 so we need to 
provide both PHP5 or PHP4 web servers until 
the end of this year.

Apache2 MPM use less memory. We want to use
it on all PHP5 and PHP4 servers to handle more
simultaneous web connections.

For info, the bug is not present when 
tpixels/TrueColor is used in gdImageCreate
another patch (for testing purpose only) 
make my sample script avoid locking Apache2 
but the bug is related to proper mutex in 
font calls so the best patch is my previous
unix_gd_mutex.patch.

--- ext/gd/libgd/gd.c   2007-04-14 19:38:38.0 +0200
+++ ext/gd/libgd/gd.c   2007-08-27 11:46:21.648861476 +0200
@@ -120,12 +120,13 @@

 gdImagePtr gdImageCreate (int sx, int sy)
 {
+   int x, y, white;
int i;
gdImagePtr im;
im = (gdImage *) gdMalloc(sizeof(gdImage));
memset(im, 0, sizeof(gdImage));
/* Row-major ever since gd 1.3 */
-   im-pixels = (unsigned char **) safe_emalloc(sizeof(unsigned 
char *), sy, 0);
+   im-tpixels = (int **) safe_emalloc(sizeof(int *), sy, 0);
im-AA_opacity = (unsigned char **) 
safe_emalloc(sizeof(unsigned char *), sy, 0);
im-polyInts = 0;
im-polyAllocated = 0;
@@ -134,29 +135,27 @@
im-style = 0;
for (i = 0; i  sy; i++) {
/* Row-major ever since gd 1.3 */
-   im-pixels[i] = (unsigned char *) gdCalloc(sx, 
sizeof(unsigned char));
+   im-tpixels[i] = (int *) gdCalloc(sx, sizeof(int));
im-AA_opacity[i] = (unsigned char *) gdCalloc(sx, 
sizeof(unsigned char));
}
im-sx = sx;
im-sy = sy;
-   im-colorsTotal = 0;
im-transparent = (-1);
im-interlace = 0;
im-thick = 1;
im-AA = 0;
im-AA_polygon = 0;
-   for (i = 0; i  gdMaxColors; i++) {
-   im-open[i] = 1;
-   im-red[i] = 0;
-   im-green[i] = 0;
-   im-blue[i] = 0;
-   }
-   im-trueColor = 0;
-   im-tpixels = 0;
+   im-trueColor = 1;
im-cx1 = 0;
im-cy1 = 0;
im-cx2 = im-sx - 1;
im-cy2 = im-sy - 1;
+   white = gdImageColorAllocate (im, 255, 255, 255);
+   for (x = 0; x  sx; x++) {
+   for (y = 0; y  sy; y++) {
+   gdImageSetPixel(im, x, y, white);
+   }
+   }
return im;
 }


Previous Comments:


[2007-08-27 16:52:36] [EMAIL PROTECTED]

--with-ttf --enable-gd-native-ttf 
Are you sure you need freetype support?

I meant: do you really need freetype 1.x support?

About your patch, as I said the TS fix will not be back ported to 4.x

There is many other issues to be fixed in php4 to get somehow thread
safe. I'll ask our release master about this patch but you should really
think about upgrading to php5. Using php4 with apache2 (in threaded
mode) is really not a good idea.



[2007-08-27 12:33:15] baco at infomaniak dot ch

The PHP development team hereby announces that support for PHP 4 
will continue until the end of this year only. 

So you need to supported PHP 4 users community until the end of this 
year right ?

I have fixed this bug by backporting mutex changes in gd from 5.2.3 
to 4.4.7. No more Apache2 locks.

Please include my patch in snap 4.4-dev so it can be included the 
next 4.4.8 and change the ticket status to Fixed...

http://www.infomaniak.ch/php4/unix_gd_mutex.patch

Best Regards,
Guy Baconniere

Reproduce code:
---

$crash = 1;
$text = 'Bug';
$font = $_SERVER['DOCUMENT_ROOT'] . '/fonts' .'/'. 'arial.ttf';

if ($crash == 1) {
$image = imagecreate(64, 32);
} else {
$image = imagecreatetruecolor(64, 32);
}

$bg = imagecolorallocate($image, 0, 0, 0);
$fg = imagecolorallocate($image, 255, 255, 255);

/* LOCK APACHE2 PROCESS AFTER THIS POINT IF crash == 1
 * = if imagecreate() used but not if imagecreatetruecolor()
 */
imagettftext($image, 20, 0, 8, 24, $fg, $font, $text);

header('Content-type: image/png');
imagepng($image);

imagedestroy($image);

Proposed patch:
---
--- ext/gd/config.m42007-03-10 14:06:37.0 +0100
+++ ext/gd/config.m42007-08-27 13:39:51.554453976 +0200
@@ -259,6 +259,7 @@
   PHP_CHECK_LIBRARY

#42416 [WFx-Csd]: Apache2 locked imagecreate with imagettftext

2007-08-27 Thread baco at infomaniak dot ch
 ID:   42416
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Wont fix
+Status:   Closed
 Bug Type: GD related
 Operating System: Linux
 PHP Version:  4.4.7
 Assigned To:  pajoye
 New Comment:

...


Previous Comments:


[2007-08-27 18:32:41] [EMAIL PROTECTED]

I appreciate your effort to provide patches but the problem is _not_ in
gdImageCreate or gdImageCreateTrueColor.

About php4, we are not going to apply these patches. It is now a sure
thing.

Freetype1 is not supported anymore since years, it is a dead project
and have hundred of issues. Mixing both mpm and freetype1 is a call for
troubles.

I think I have you all infos you need to take the right choices. I
suggest you to do not apply the gdImageCreate patch, it is not the
source of the problem and it breaks so many things.

I'm sorry but there is no need to reply to this post or to add
comments. The status won't change.



[2007-08-27 17:49:03] baco at infomaniak dot ch

Yes, our customers are using both freetype 
1.x and 2.x calls. We can't stop support
old calls.

If you disable both --with-ttf and 
--enable-gd-native-ttf apache2 are also
locked by calling imagefttext() when
imagecreate() is used.

We are a web hosting provider and some of our 
customers are using PHP scripts who are not 
(yet) compatible with PHP 5 so we need to 
provide both PHP5 or PHP4 web servers until 
the end of this year.

Apache2 MPM use less memory. We want to use
it on all PHP5 and PHP4 servers to handle more
simultaneous web connections.

For info, the bug is not present when 
tpixels/TrueColor is used in gdImageCreate
another patch (for testing purpose only) 
make my sample script avoid locking Apache2 
but the bug is related to proper mutex in 
font calls so the best patch is my previous
unix_gd_mutex.patch.

--- ext/gd/libgd/gd.c   2007-04-14 19:38:38.0 +0200
+++ ext/gd/libgd/gd.c   2007-08-27 11:46:21.648861476 +0200
@@ -120,12 +120,13 @@

 gdImagePtr gdImageCreate (int sx, int sy)
 {
+   int x, y, white;
int i;
gdImagePtr im;
im = (gdImage *) gdMalloc(sizeof(gdImage));
memset(im, 0, sizeof(gdImage));
/* Row-major ever since gd 1.3 */
-   im-pixels = (unsigned char **) safe_emalloc(sizeof(unsigned 
char *), sy, 0);
+   im-tpixels = (int **) safe_emalloc(sizeof(int *), sy, 0);
im-AA_opacity = (unsigned char **) 
safe_emalloc(sizeof(unsigned char *), sy, 0);
im-polyInts = 0;
im-polyAllocated = 0;
@@ -134,29 +135,27 @@
im-style = 0;
for (i = 0; i  sy; i++) {
/* Row-major ever since gd 1.3 */
-   im-pixels[i] = (unsigned char *) gdCalloc(sx, 
sizeof(unsigned char));
+   im-tpixels[i] = (int *) gdCalloc(sx, sizeof(int));
im-AA_opacity[i] = (unsigned char *) gdCalloc(sx, 
sizeof(unsigned char));
}
im-sx = sx;
im-sy = sy;
-   im-colorsTotal = 0;
im-transparent = (-1);
im-interlace = 0;
im-thick = 1;
im-AA = 0;
im-AA_polygon = 0;
-   for (i = 0; i  gdMaxColors; i++) {
-   im-open[i] = 1;
-   im-red[i] = 0;
-   im-green[i] = 0;
-   im-blue[i] = 0;
-   }
-   im-trueColor = 0;
-   im-tpixels = 0;
+   im-trueColor = 1;
im-cx1 = 0;
im-cy1 = 0;
im-cx2 = im-sx - 1;
im-cy2 = im-sy - 1;
+   white = gdImageColorAllocate (im, 255, 255, 255);
+   for (x = 0; x  sx; x++) {
+   for (y = 0; y  sy; y++) {
+   gdImageSetPixel(im, x, y, white);
+   }
+   }
return im;
 }



[2007-08-27 16:52:36] [EMAIL PROTECTED]

--with-ttf --enable-gd-native-ttf 
Are you sure you need freetype support?

I meant: do you really need freetype 1.x support?

About your patch, as I said the TS fix will not be back ported to 4.x

There is many other issues to be fixed in php4 to get somehow thread
safe. I'll ask our release master about this patch but you should really
think about upgrading to php5. Using php4 with apache2 (in threaded
mode) is really not a good idea.



[2007-08-27 12:33:15] baco at infomaniak dot ch

The PHP development team hereby announces that support for PHP 4 
will continue until the end of this year only. 

So you need to supported PHP 4 users community until the end of this 
year right ?

I have fixed this bug by backporting mutex changes in gd from 5.2.3 
to 4.4.7. No more Apache2 locks.

Please include my patch in snap 4.4-dev so it can be included the 
next 4.4.8 and change the ticket status to Fixed...

http

#42416 [NEW]: Apache2 locked imagecreate with imagettftext

2007-08-24 Thread baco at infomaniak dot ch
From: baco at infomaniak dot ch
Operating system: Linux
PHP version:  4.4.7
PHP Bug Type: GD related
Bug description:  Apache2 locked imagecreate with imagettftext

Description:

Reproductible with PHP 4.4.7 
or with the last Snap 4.4-dev
on Apache2 using MPM worker.

Apache2 process get locked when calling
imagettftext() after calling imagecreate()
every call of such code result of another
dead locked Apache2 processes.

Workarounds :
- Use imagecreatetruecolor() instead of imagecreate()
- Don't use bundled gdlib compile PHP with external gdlib
- Upgrade 5.2.3 who don't have this issue

Reproductible with
configure \
--with-gd \
--with-png-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...

Unreproductible with external gd
configure \
--with-gd=/opt/misc/gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...



Reproduce code:
---
$crash = 1;
$text = 'Bug';
$font = $_SERVER['DOCUMENT_ROOT'] . '/fonts' .'/'. 'arial.ttf';

if ($crash == 1) {
$image = imagecreate(64, 32);
} else {
$image = imagecreatetruecolor(64, 32);
}

$white = imagecolorallocate($image, 255, 255, 255);

/* LOCK APACHE2 PROCESS AFTER THIS POINT IF crash == 1
 * = if imagecreate() used but not if imagecreatetruecolor()
 */
imagettftext($image, 20, 0, 8, 24, $white, $font, $text);

header('Content-type: image/png');
imagepng($image);

imagedestroy($image);


Expected result:

Display Bug white text on black background

Actual result:
--
Apache2 process get locked and browser wait for the
image forever. 

After it is a matter of time for Apache2 to have 
all processes locked depending on your ServerLimit
and ThreadsPerChild values.

-- 
Edit bug report at http://bugs.php.net/?id=42416edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42416r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42416r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42416r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42416r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=42416r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=42416r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=42416r=needscript
Try newer version:http://bugs.php.net/fix.php?id=42416r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=42416r=support
Expected behavior:http://bugs.php.net/fix.php?id=42416r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=42416r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=42416r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42416r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42416r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42416r=dst
IIS Stability:http://bugs.php.net/fix.php?id=42416r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=42416r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42416r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=42416r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=42416r=mysqlcfg


#42416 [Opn]: Apache2 locked imagecreate with imagettftext

2007-08-24 Thread baco at infomaniak dot ch
 ID:   42416
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Open
 Bug Type: GD related
 Operating System: Linux
 PHP Version:  4.4.7
 New Comment:

see diff in gdImageCreate()

--- php-4.4.7/ext/gd/libgd/gd.c   2007-08-24 19:39:33.999613335 
+0200
+++ php-5.2.3/ext/gd/libgd/gd.c   2007-08-24 19:39:53.052804086 
+0200
@@ -5,8 +5,8 @@
 im = (gdImage *) gdMalloc(sizeof(gdImage));
 memset(im, 0, sizeof(gdImage));
 /* Row-major ever since gd 1.3 */
-im-pixels = (unsigned char **) safe_emalloc(sizeof(unsigned 
char *), sy, 0);
-im-AA_opacity = (unsigned char **) safe_emalloc(sizeof(unsigned 
char *), sy, 0);
+im-pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) 
* sy);
+im-AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned 
char *) * sy);
 im-polyInts = 0;
 im-polyAllocated = 0;
 im-brush = 0;


Previous Comments:


[2007-08-24 16:17:42] baco at infomaniak dot ch

Description:

Reproductible with PHP 4.4.7 
or with the last Snap 4.4-dev
on Apache2 using MPM worker.

Apache2 process get locked when calling
imagettftext() after calling imagecreate()
every call of such code result of another
dead locked Apache2 processes.

Workarounds :
- Use imagecreatetruecolor() instead of imagecreate()
- Don't use bundled gdlib compile PHP with external gdlib
- Upgrade 5.2.3 who don't have this issue

Reproductible with
configure \
--with-gd \
--with-png-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...

Unreproductible with external gd
configure \
--with-gd=/opt/misc/gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...



Reproduce code:
---
$crash = 1;
$text = 'Bug';
$font = $_SERVER['DOCUMENT_ROOT'] . '/fonts' .'/'. 'arial.ttf';

if ($crash == 1) {
$image = imagecreate(64, 32);
} else {
$image = imagecreatetruecolor(64, 32);
}

$white = imagecolorallocate($image, 255, 255, 255);

/* LOCK APACHE2 PROCESS AFTER THIS POINT IF crash == 1
 * = if imagecreate() used but not if imagecreatetruecolor()
 */
imagettftext($image, 20, 0, 8, 24, $white, $font, $text);

header('Content-type: image/png');
imagepng($image);

imagedestroy($image);


Expected result:

Display Bug white text on black background

Actual result:
--
Apache2 process get locked and browser wait for the
image forever. 

After it is a matter of time for Apache2 to have 
all processes locked depending on your ServerLimit
and ThreadsPerChild values.





-- 
Edit this bug report at http://bugs.php.net/?id=42416edit=1


#41148 [NEW]: PHP 4.4.6 Segfault with PCRE 7.0 not with 6.6

2007-04-20 Thread baco at infomaniak dot ch
From: baco at infomaniak dot ch
Operating system: Linux/Debian
PHP version:  4.4.6
PHP Bug Type: PCRE related
Bug description:  PHP 4.4.6 Segfault with PCRE 7.0 not with 6.6

Description:

After upgrading PHP from 4.4.4 to 4.4.6 our customers using
SPIP, Joomla Mambot, etc. their websites display a blank page
or 500 due to a segfault of PHP.

I have backported PCRE from version 7.0 to 6.6 on PHP 4.4.6.
No more segfault of PHP and SPIP works as before.

http://www.infomaniak.ch/php4/php-4.4.6-downgrade_pcre.patch
http://www.infomaniak.ch/php4/

Best Regards,
Guy Baconniere baco(A-T)infomaniak.ch

REFERENCES
http://www.guiderdoni.net/Probleme-Spip-et-php-version-4-4-6.html
http://bugs.php.net/bug.php?id=41050


Reproduce code:
---
1. Compile PHP 4.4.6 without my patch
2. install any version of SPIP including 1.9.2 (http://www.spip.net)

N.B. Only 1.9.2a has a workaround see
http://trac.rezo.net/trac/spip/changeset/8844

I understand this maybe a bug in PCRE 7.0 (see bug #41050)
but why do you not downgrade to 6.6 until fixed so your last PHP 4.4.x
will be again more stable ?


Expected result:

SPIP working.

Actual result:
--
Blank page, HTTP 500, segfault of PHP.

-- 
Edit bug report at http://bugs.php.net/?id=41148edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41148r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41148r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41148r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41148r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=41148r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=41148r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=41148r=needscript
Try newer version:http://bugs.php.net/fix.php?id=41148r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=41148r=support
Expected behavior:http://bugs.php.net/fix.php?id=41148r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=41148r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=41148r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41148r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41148r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41148r=dst
IIS Stability:http://bugs.php.net/fix.php?id=41148r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=41148r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41148r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=41148r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=41148r=mysqlcfg


#41148 [Bgs-Opn]: PHP 4.4.6 Segfault with PCRE 7.0 not with 6.6

2007-04-20 Thread baco at infomaniak dot ch
 ID:   41148
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Bogus
+Status:   Open
 Bug Type: PCRE related
 Operating System: Linux/Debian
 PHP Version:  4.4.6
 New Comment:

I can reproduce this bug with this code
please confirm if you can also on your version
of PHP 4.4.6.

Ok even this bug isn't in PHP and you know
there is an overflow inside last version PCRE 7.0
Why to you still use 7.0 in the official stable 
release of PHP 4.4.6 and not downgrade to 6.6 ?

cat 'EOT'  bug_pcre.php
?php

$letexte=brbr;

$cherche1 = array(
/* 0 */ /\n(+|+)/S,
/* 1 */ /\n-- */S,
/* 2 */ /\n- */S,
/* 3 */ /\n_ +/S,
/* 4 */   /(^|[^{])[{][{][{]/S,
/* 5 */   /[}][}][}]($|[^}])/S,
/* 6 */ /(( *)\n){2,}(br[[:space:]]*\/?.)?/S,
/* 7 */ /[{][{]/S,
/* 8 */ /[}][}]/S,
/* 9 */ /[{]/S,
/* 10 *//[}]/S,
/* 11 *//(br[[:space:]]*\/?.){2,}/S,
/* 12 *//p([\n]*(br[[:space:]]*\/?.)*)*/S,
/* 13 *//quote/S,
/* 14 *//\/quote/S
);
$remplace1 = array(
/* 0 */ \n\n$ligne_horizontale\n\n,
/* 1 */ \nbr /mdash;nbsp;,
/* 2 */ \nbr /$pucenbsp;,
/* 3 */ \nbr /,
/* 4 */ \$1\n\n$debut_intertitre,
/* 5 */ $fin_intertitre\n\n\$1,
/* 6 */ p,
/* 7 */ strong class=\spip\,
/* 8 */ /strong,
/* 9 */ i class=\spip\,
/* 10 *//i,
/* 11 */p,
/* 12 */p,
/* 13 */blockquote class=\spip\p,
/* 14 *//blockquotep
);
$letexte = preg_replace($cherche1, $remplace1, $letexte);
$letexte = preg_replace(@^ br /@S, , $letexte);

print $letexte;

?
EOT

gdb /opt/php/bin/php
(gdb) set args bug_pcre.php
(gdb) run
Starting program: /opt/php/bin/php bug_pcre.php
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 1864)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 1864)]
0x0809f3bb in match (eptr=0x894e787 , 
ecode=0x894f1a7 \026\026b\026rH, offset_top=4,
md=0xbfc6f530, ims=0, eptrb=0x0, flags=143978919, rdepth=1673)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:570
570
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c: 
No such file or directory.

in /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c
(gdb) bt
#0  0x0809f3bb in match (eptr=0x894e787 , 
ecode=0x894f1a7 \026\026b\026rH, offset_top=4,
md=0xbfc6f530, ims=0, eptrb=0x0, flags=143978919, rdepth=1673)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:570
#1  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f1a2 Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1673, rdepth=1672)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#2  0x080a1191 in match (eptr=0x894e787 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=0, rdepth=1671)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1071
#3  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1671, rdepth=1670)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#4  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f19a Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1670, rdepth=1669)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#5  0x080aab69 in match (eptr=0x894e787 , ecode=0x894f1d6 P, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=143978906, rdepth=1668)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1195
#6  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1668, rdepth=1667)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#7  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f19a Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1667, rdepth=1666)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#8  0x080aab69 in match (eptr=0x894e787 , ecode=0x894f1d6 P, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=143978906, rdepth=1665)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1195
#9  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1665, rdepth=1664)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#10 0x080ab088 in match (eptr=0x894e787 , ecode=0x894f19a Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1664, rdepth=1663)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#11 0x080aab69

#41148 [Opn]: PHP 4.4.6 Segfault with PCRE 7.0 not with 6.6

2007-04-20 Thread baco at infomaniak dot ch
 ID:   41148
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Open
 Bug Type: PCRE related
 Operating System: Linux/Debian
 PHP Version:  4.4.6
 New Comment:

Juste a simple question :

Why PHP 4.4.6 Stable has PCRE 7.0 and PHP 5.2.1 Stable has PCRE 
6.7 ?


Previous Comments:


[2007-04-20 13:51:01] baco at infomaniak dot ch

I can reproduce this bug with this code
please confirm if you can also on your version
of PHP 4.4.6.

Ok even this bug isn't in PHP and you know
there is an overflow inside last version PCRE 7.0
Why to you still use 7.0 in the official stable 
release of PHP 4.4.6 and not downgrade to 6.6 ?

cat 'EOT'  bug_pcre.php
?php

$letexte=brbr;

$cherche1 = array(
/* 0 */ /\n(+|+)/S,
/* 1 */ /\n-- */S,
/* 2 */ /\n- */S,
/* 3 */ /\n_ +/S,
/* 4 */   /(^|[^{])[{][{][{]/S,
/* 5 */   /[}][}][}]($|[^}])/S,
/* 6 */ /(( *)\n){2,}(br[[:space:]]*\/?.)?/S,
/* 7 */ /[{][{]/S,
/* 8 */ /[}][}]/S,
/* 9 */ /[{]/S,
/* 10 *//[}]/S,
/* 11 *//(br[[:space:]]*\/?.){2,}/S,
/* 12 *//p([\n]*(br[[:space:]]*\/?.)*)*/S,
/* 13 *//quote/S,
/* 14 *//\/quote/S
);
$remplace1 = array(
/* 0 */ \n\n$ligne_horizontale\n\n,
/* 1 */ \nbr /mdash;nbsp;,
/* 2 */ \nbr /$pucenbsp;,
/* 3 */ \nbr /,
/* 4 */ \$1\n\n$debut_intertitre,
/* 5 */ $fin_intertitre\n\n\$1,
/* 6 */ p,
/* 7 */ strong class=\spip\,
/* 8 */ /strong,
/* 9 */ i class=\spip\,
/* 10 *//i,
/* 11 */p,
/* 12 */p,
/* 13 */blockquote class=\spip\p,
/* 14 *//blockquotep
);
$letexte = preg_replace($cherche1, $remplace1, $letexte);
$letexte = preg_replace(@^ br /@S, , $letexte);

print $letexte;

?
EOT

gdb /opt/php/bin/php
(gdb) set args bug_pcre.php
(gdb) run
Starting program: /opt/php/bin/php bug_pcre.php
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 1864)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 1864)]
0x0809f3bb in match (eptr=0x894e787 , 
ecode=0x894f1a7 \026\026b\026rH, offset_top=4,
md=0xbfc6f530, ims=0, eptrb=0x0, flags=143978919, rdepth=1673)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:570
570
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c: 
No such file or directory.

in /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c
(gdb) bt
#0  0x0809f3bb in match (eptr=0x894e787 , 
ecode=0x894f1a7 \026\026b\026rH, offset_top=4,
md=0xbfc6f530, ims=0, eptrb=0x0, flags=143978919, rdepth=1673)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:570
#1  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f1a2 Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1673, rdepth=1672)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#2  0x080a1191 in match (eptr=0x894e787 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=0, rdepth=1671)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1071
#3  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1671, rdepth=1670)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#4  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f19a Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1670, rdepth=1669)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#5  0x080aab69 in match (eptr=0x894e787 , ecode=0x894f1d6 P, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=143978906, rdepth=1668)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1195
#6  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1668, rdepth=1667)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#7  0x080ab088 in match (eptr=0x894e787 , ecode=0x894f19a Y, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1667, rdepth=1666)

at /root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:629
#8  0x080aab69 in match (eptr=0x894e787 , ecode=0x894f1d6 P, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=143978906, rdepth=1665)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:1195
#9  0x080a2893 in match (eptr=0x894e786 , ecode=0x894f1a1 aY, 
offset_top=4, md=0xbfc6f530,
ims=0, eptrb=0x0, flags=1665, rdepth=1664)

at
/root/SOURCES/php4-debug/php-4.4.6/ext/pcre/pcrelib/pcre_exec.c:2209
#10 0x080ab088

#41148 [Bgs]: PHP 4.4.6 Segfault with PCRE 7.0 not with 6.6

2007-04-20 Thread baco at infomaniak dot ch
 ID:   41148
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Bogus
 Bug Type: PCRE related
 Operating System: Linux/Debian
 PHP Version:  4.4.6
 New Comment:

OK leave this as bogus and
users of PHP 4.4.6+ MUST use --with-pcre-regex=

Just for info :

-No comments-

PHP 5.2.1 / 08 Feb 2007
pcre-6.7 / 05.07.2006

PHP 4.4.6 / 01 Mar 2007
pcre-7.0 / 19.12.2006

PHP 4.4.4 / ...
pcre-6.6 / 06.02.2006

-No comments-


Previous Comments:


[2007-04-20 16:19:20] [EMAIL PROTECTED]

Because 4.4.6 has been release AFTER 5.2.1.

You don't HAVE to use the bundled PCRE, so please spend your time on
helping PCRE developers to fix this issue.
Thank you.



[2007-04-20 16:09:58] baco at infomaniak dot ch

Juste a simple question :

Why PHP 4.4.6 Stable has PCRE 7.0 and PHP 5.2.1 Stable has PCRE 
6.7 ?



[2007-04-20 11:22:19] [EMAIL PROTECTED]

A stack overflow in PCRE is known problem, but PCRE bugs should be
reported to PCRE developers.
Please search the database before reporting.

And yes, you don't have to apply any patches in order to build PHP with
external PCRE.
Use --with-pcre-regex=DIR option to do that.



[2007-04-20 11:08:35] baco at infomaniak dot ch

Description:

After upgrading PHP from 4.4.4 to 4.4.6 our customers using
SPIP, Joomla Mambot, etc. their websites display a blank page
or 500 due to a segfault of PHP.

I have backported PCRE from version 7.0 to 6.6 on PHP 4.4.6.
No more segfault of PHP and SPIP works as before.

http://www.infomaniak.ch/php4/php-4.4.6-downgrade_pcre.patch
http://www.infomaniak.ch/php4/

Best Regards,
Guy Baconniere baco(A-T)infomaniak.ch

REFERENCES
http://www.guiderdoni.net/Probleme-Spip-et-php-version-4-4-6.html
http://bugs.php.net/bug.php?id=41050


Reproduce code:
---
1. Compile PHP 4.4.6 without my patch
2. install any version of SPIP including 1.9.2 (http://www.spip.net)

N.B. Only 1.9.2a has a workaround see
http://trac.rezo.net/trac/spip/changeset/8844

I understand this maybe a bug in PCRE 7.0 (see bug #41050)
but why do you not downgrade to 6.6 until fixed so your last PHP 4.4.x
will be again more stable ?


Expected result:

SPIP working.

Actual result:
--
Blank page, HTTP 500, segfault of PHP.





-- 
Edit this bug report at http://bugs.php.net/?id=41148edit=1


#38017 [NEW]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
From: baco at infomaniak dot ch
Operating system: Linux Debian Sarge
PHP version:  5.1.4
PHP Bug Type: XML related
Bug description:  Segfault on xml_parser_create() call

Description:

PHP5 Segmentation fault when a script call   
xml_parser_create() under Apache but not when called   
from the CLI ?!? 
  
$ wget -O- http://.../xml.php  
 
= Crash of Apache thread  
 
HTTP request sent, awaiting response... 
End of file while parsing headers. 
Retrying. 
child pid ... exit signal Segmentation fault (11)   
   
$ php xml.php 
 
= result OK  

Reproduce code:
---
PHP Code to reproduce the segmentation fault inside Apache

$file = data.xml;
$data = '';

if (!($fp = fopen($file, r))) {
die(could not open XML input);
}
while (!feof($fp)) {
$data .= fread($fp, 8192);
}
fclose($fp);

$xml_parser = xml_parser_create(ISO-8859-1);
# crash at this point
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
print_r($vals);


Expected result:

Expected to return on Apache but only output this when I  
call the script from PHP CLI. 
  
Array   
(   
[0] = Array   
(   
   ...   
)  
 ...  
)  
 

Actual result:
--
N.B.  
php.ini and php-cli.ini are the same.
ldd on php cli and on libphp5.so both  
use same libxml2 from Debian Sarge.   
 
Result 
 
(gdb) continue 
 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210239712 (LWP 28800)] 
0x0808b14c in XML_ParserFree () 
 
strace 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test-xml/data.xml, 
O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=113, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?xml version=\1.0\ encoding=\IS..., 8192) = 
113 
read(7, , 8192)   = 0 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid()= 28871 
kill(28871, SIGSEGV)= 0 
sigreturn() = ? (mask now []) 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
 
PHP Compiled with 
 
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man' 
'--with-apxs=/opt/apache/bin/apxs' '--disable-cgi' 
'--with-config-file-path=/opt/php/lib' '--disable-sigchild' 
'--disable-ipv6' '--disable-all' '--enable-libxml' 
'--with-libxml-dir' '--with-openssl' '--with-kerberos' 
'--with-pcre-regex' '--with-zlib' '--with-zlib-dir' 
'--enable-bcmath' '--enable-calendar' '--enable-ctype' 
'--with-curl' '--enable-dom' '--enable-exif' '--enable-ftp' 
'--with-openssl-dir' '--with-gd' '--with-jpeg-dir' 
'--with-png-dir' '--with-xpm-dir' '--with-ttf' 
'--with-freetype-dir' '--enable-gd-native-ttf' 
'--with-gettext' '--with-gmp' '--with-iconv' '--with-imap' 
'--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' 
'--with-mcrypt' '--with-mhash' 
'--with-mysql=/opt/misc/mysql' 
'--with-mysqli=/opt/misc/mysql/bin/mysql_config' 
'--enable-pdo' '--with-pdo-mysql=/opt/misc/mysql' 
'--enable-posix' '--enable-session' '--enable-simplexml' 
'--enable-soap' '--enable-spl' '--with-tidy' 
'--enable-tokenizer' '--enable-wddx' '--enable-xml' 
'--with-libexpat-dir' '--with-xmlrpc' '--with-iconv-dir' 
'--with-xsl' '--with-pear' '--enable-memory-limit' 
'--enable-zend-multibyte' '--with-ming=/opt/misc/ming' 
'--enable-debug' 
 
 

-- 
Edit bug report at http://bugs.php.net/?id=38017edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38017r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38017r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38017r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38017r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=38017r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=38017r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=38017r=needscript
Try newer version:http://bugs.php.net/fix.php?id=38017r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=38017r=support
Expected behavior:http://bugs.php.net/fix.php?id=38017r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=38017r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=38017r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38017r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38017r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38017r=dst
IIS Stability:http://bugs.php.net/fix.php?id=38017r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=38017r=gnused
Floating point

#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

Exemple without any external xml.  
  
$ cat test.php   
   
?php   
 $data = '?xml version=1.0   
encoding=ISO-8859-1 ?baco/baco';   
 $xml_parser = xml_parser_create(ISO-8859-1);   
 xml_parse_into_struct($xml_parser, $data, $vals, $index);   
 xml_parser_free($xml_parser);   
 print_r($vals);   
?   
   
$ /opt/php/bin/php test.php   
   
Array   
(   
[0] = Array   
(   
[tag] = BACO   
[type] = complete   
[level] = 1   
)   
   
)   
   
$ wget -O- http://localhost/test.php   

   
Connecting to localhost[127.0.0.1]:80... connected.   
HTTP request sent, awaiting response...   
End of file while parsing headers.   
Retrying.   
...looping forever...   
   
$ tail -n1 /var/log/httpd/error   
[Wed Jul  5 19:48:49 2006] [notice] child pid 28993 exit   
signal Segmentation fault (11)


Previous Comments:


[2006-07-05 17:34:19] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.





[2006-07-05 17:32:55] baco at infomaniak dot ch

Description:

PHP5 Segmentation fault when a script call   
xml_parser_create() under Apache but not when called   
from the CLI ?!? 
  
$ wget -O- http://.../xml.php  
 
= Crash of Apache thread  
 
HTTP request sent, awaiting response... 
End of file while parsing headers. 
Retrying. 
child pid ... exit signal Segmentation fault (11)   
   
$ php xml.php 
 
= result OK  

Reproduce code:
---
PHP Code to reproduce the segmentation fault inside Apache

$file = data.xml;
$data = '';

if (!($fp = fopen($file, r))) {
die(could not open XML input);
}
while (!feof($fp)) {
$data .= fread($fp, 8192);
}
fclose($fp);

$xml_parser = xml_parser_create(ISO-8859-1);
# crash at this point
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
print_r($vals);


Expected result:

Expected to return on Apache but only output this when I  
call the script from PHP CLI. 
  
Array   
(   
[0] = Array   
(   
   ...   
)  
 ...  
)  
 

Actual result:
--
N.B.  
php.ini and php-cli.ini are the same.
ldd on php cli and on libphp5.so both  
use same libxml2 from Debian Sarge.   
 
Result 
 
(gdb) continue 
 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210239712 (LWP 28800)] 
0x0808b14c in XML_ParserFree () 
 
strace 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test-xml/data.xml,

O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=113, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?xml version=\1.0\ encoding=\IS..., 8192) = 
113 
read(7, , 8192)   = 0 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid()= 28871 
kill(28871, SIGSEGV)= 0 
sigreturn() = ? (mask now []) 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
 
PHP Compiled with 
 
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man' 
'--with-apxs=/opt/apache/bin/apxs' '--disable-cgi' 
'--with-config-file-path=/opt/php/lib' '--disable-sigchild' 
'--disable-ipv6' '--disable-all' '--enable-libxml' 
'--with-libxml-dir' '--with-openssl' '--with-kerberos' 
'--with-pcre-regex' '--with-zlib' '--with-zlib-dir' 
'--enable-bcmath' '--enable-calendar' '--enable-ctype' 
'--with-curl' '--enable-dom' '--enable-exif' '--enable-ftp' 
'--with-openssl-dir' '--with-gd' '--with-jpeg-dir' 
'--with-png-dir' '--with-xpm-dir' '--with-ttf' 
'--with-freetype-dir' '--enable-gd-native-ttf' 
'--with-gettext' '--with-gmp' '--with-iconv' '--with-imap' 
'--with-imap-ssl' '--enable-mbstring' '--enable-mbregex' 
'--with-mcrypt' '--with-mhash' 
'--with-mysql=/opt/misc/mysql' 
'--with-mysqli=/opt/misc/mysql/bin/mysql_config' 
'--enable-pdo' '--with-pdo-mysql=/opt/misc/mysql' 
'--enable-posix' '--enable-session' '--enable-simplexml' 
'--enable-soap' '--enable

#38017 [Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

New strace of previous code 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test.php, 
O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=235, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?php\n\t$data = \'?xml version=\1..., 8192) = 
235 
read(7, , 8192)   = 0 
read(7, , 8192)   = 0 
brk(0)  = 0x85f2000 
brk(0x8613000)  = 0x8613000 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid()= 29068 
kill(29068, SIGSEGV)= 0 
sigreturn() = ? (mask now []) 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
Process 29068 detached 
 
New gdb output from new code 
 
(gdb) continue 
Continuing. 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210239712 (LWP 29128)] 
0xb7e4e07f in memcpy () from /lib/tls/libc.so.6


Previous Comments:


[2006-07-05 17:51:45] baco at infomaniak dot ch

Exemple without any external xml.  
  
$ cat test.php   
   
?php   
 $data = '?xml version=1.0   
encoding=ISO-8859-1 ?baco/baco';   
 $xml_parser = xml_parser_create(ISO-8859-1);   
 xml_parse_into_struct($xml_parser, $data, $vals, $index);   
 xml_parser_free($xml_parser);   
 print_r($vals);   
?   
   
$ /opt/php/bin/php test.php   
   
Array   
(   
[0] = Array   
(   
[tag] = BACO   
[type] = complete   
[level] = 1   
)   
   
)   
   
$ wget -O- http://localhost/test.php   

   
Connecting to localhost[127.0.0.1]:80... connected.   
HTTP request sent, awaiting response...   
End of file while parsing headers.   
Retrying.   
...looping forever...   
   
$ tail -n1 /var/log/httpd/error   
[Wed Jul  5 19:48:49 2006] [notice] child pid 28993 exit   
signal Segmentation fault (11)



[2006-07-05 17:34:19] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.





[2006-07-05 17:32:55] baco at infomaniak dot ch

Description:

PHP5 Segmentation fault when a script call   
xml_parser_create() under Apache but not when called   
from the CLI ?!? 
  
$ wget -O- http://.../xml.php  
 
= Crash of Apache thread  
 
HTTP request sent, awaiting response... 
End of file while parsing headers. 
Retrying. 
child pid ... exit signal Segmentation fault (11)   
   
$ php xml.php 
 
= result OK  

Reproduce code:
---
PHP Code to reproduce the segmentation fault inside Apache

$file = data.xml;
$data = '';

if (!($fp = fopen($file, r))) {
die(could not open XML input);
}
while (!feof($fp)) {
$data .= fread($fp, 8192);
}
fclose($fp);

$xml_parser = xml_parser_create(ISO-8859-1);
# crash at this point
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
print_r($vals);


Expected result:

Expected to return on Apache but only output this when I  
call the script from PHP CLI. 
  
Array   
(   
[0] = Array   
(   
   ...   
)  
 ...  
)  
 

Actual result:
--
N.B.  
php.ini and php-cli.ini are the same.
ldd on php cli and on libphp5.so both  
use same libxml2 from Debian Sarge.   
 
Result 
 
(gdb) continue 
 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210239712 (LWP 28800)] 
0x0808b14c in XML_ParserFree () 
 
strace 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test-xml/data.xml,

O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=113, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?xml version=\1.0\ encoding=\IS..., 8192) = 
113 
read(7, , 8192)   = 0 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid

#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

Thanks for the link how-to debug PHP because with first 
method I wasn't able to have a core file. 
 
gdb bin/httpd 
... 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210309344 (LWP 29253)] 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
 
bt 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
(gdb) bt 
#0  0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
#1  0x0808b76f in XML_Parse () 
#2  0x085f03e4 in ?? () 
#3  0x0039 in ?? () 
#4  0xb78e225e in _emalloc (size=140444644, 
__zend_filename=0xb78a1ac0 
U1À\211å\203ì(\211D$\0301À\211D$\024¸Ç, 
__zend_lineno=0, __zend_orig_filename=0x0, 
__zend_orig_lineno=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend_alloc.c:214

#5  0xb7919aa8 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfb698c0) 
at zend_vm_execute.h:200 
#6  0xb79191c8 in execute (op_array=0x85f009c) at 
zend_vm_execute.h:92 
#7  0xb78fb430 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend.c:1109

#8  0xb78b77c3 in php_execute_script 
(primary_file=0xbfb6bc40) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/main/main.c:1732

#9  0xb796fee9 in apache_php_module_main (r=0x812289c, 
display_source_mode=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/sapi_apache.c:53

#10 0xb7970aca in send_php (r=0x812289c, 
display_source_mode=0, filename=0x0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:661

#11 0xb7970c53 in send_parsed_php (r=0x812289c) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:676

#12 0x08055dff in ap_invoke_handler () 
#13 0x0812289c in ?? () 
#14 0xb7b3f394 in zend_vm_decode.1 () 
from /opt/apache/libexec/libphp5.so 
#15 0x0017 in ?? () 
#16 0x in ?? () 
#17 0x in ?? () 
#18 0x in ?? () 
#19 0x080c19b4 in ?? () 
#20 0x080c19a4 in ?? () 
#21 0x08122ba4 in ?? () 
#22 0xbfb6bfa0 in ?? () 
#23 0x0002 in ?? () 
#24 0x0805592c in run_method () 
#25 0x0017 in ?? () 
#26 0x085c5ce8 in ?? () 
#27 0x0812289c in ?? () 
#28 0x084ce32c in ?? () 
#29 0x0812289c in ?? () 
#30 0xb7f54d32 in add_env_module_vars_unset () 
   from /opt/apache/libexec/mod_env.so 
#31 0x0017 in ?? () 
#32 0x in ?? () 
#33 0x084ce32c in ?? () 
#34 0x085c5ce8 in ?? () 
#35 0x0806f3c1 in process_request_internal () 
#36 0x0812289c in ?? () 
#37 0xb7f4dd68 in ?? () 
#38 0x0001 in ?? () 
#39 0x in ?? () 
#40 0x0812421c in ?? () 
#41 0x080acece in priorities () 
#42 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#43 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#44 0x08050051 in _start () 
at ../sysdeps/i386/elf/start.S:102


Previous Comments:


[2006-07-05 18:11:23] [EMAIL PROTECTED]

strace does not add any value.
But GDB backtrace could do that.
See this link http://bugs.php.net/bugs-generating-backtrace.php



[2006-07-05 18:06:29] baco at infomaniak dot ch

New strace of previous code 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test.php, 
O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=235, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?php\n\t$data = \'?xml version=\1..., 8192) = 
235 
read(7, , 8192)   = 0 
read(7, , 8192)   = 0 
brk(0)  = 0x85f2000 
brk(0x8613000)  = 0x8613000 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid()= 29068 
kill(29068, SIGSEGV)= 0 
sigreturn() = ? (mask now []) 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
Process 29068 detached 
 
New gdb output from new code 
 
(gdb) continue 
Continuing. 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210239712 (LWP 29128)] 
0xb7e4e07f in memcpy () from /lib/tls/libc.so.6



[2006-07-05 17:51:45] baco at infomaniak dot ch

Exemple without any external xml.  
  
$ cat test.php   
   
?php   
 $data = '?xml version=1.0   
encoding=ISO-8859-1 ?baco/baco';   
 $xml_parser = xml_parser_create(ISO-8859-1);   
 xml_parse_into_struct($xml_parser, $data, $vals, $index);   
 xml_parser_free($xml_parser

#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

Unable to reproduce the issue with  
  
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
  
So a special configure option do this ... ?!?


Previous Comments:


[2006-07-05 18:35:11] [EMAIL PROTECTED]

Uhm.. Now THAT doesn't make any sense to me.
What Apache version is that? And which MPM are you using if it's Apache
2? 
Also, please try to remove all those configure options which are not
required to execute this piece of code. 
I guess just ./configure --with-apxs= ... --enable-debug should be
enough.
 



[2006-07-05 18:23:54] baco at infomaniak dot ch

Thanks for the link how-to debug PHP because with first 
method I wasn't able to have a core file. 
 
gdb bin/httpd 
... 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210309344 (LWP 29253)] 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
 
bt 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
(gdb) bt 
#0  0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
#1  0x0808b76f in XML_Parse () 
#2  0x085f03e4 in ?? () 
#3  0x0039 in ?? () 
#4  0xb78e225e in _emalloc (size=140444644, 
__zend_filename=0xb78a1ac0 
U1À\211å\203ì(\211D$\0301À\211D$\024¸Ç, 
__zend_lineno=0, __zend_orig_filename=0x0, 
__zend_orig_lineno=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend_alloc.c:214

#5  0xb7919aa8 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfb698c0) 
at zend_vm_execute.h:200 
#6  0xb79191c8 in execute (op_array=0x85f009c) at 
zend_vm_execute.h:92 
#7  0xb78fb430 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend.c:1109

#8  0xb78b77c3 in php_execute_script 
(primary_file=0xbfb6bc40) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/main/main.c:1732

#9  0xb796fee9 in apache_php_module_main (r=0x812289c, 
display_source_mode=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/sapi_apache.c:53

#10 0xb7970aca in send_php (r=0x812289c, 
display_source_mode=0, filename=0x0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:661

#11 0xb7970c53 in send_parsed_php (r=0x812289c) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:676

#12 0x08055dff in ap_invoke_handler () 
#13 0x0812289c in ?? () 
#14 0xb7b3f394 in zend_vm_decode.1 () 
from /opt/apache/libexec/libphp5.so 
#15 0x0017 in ?? () 
#16 0x in ?? () 
#17 0x in ?? () 
#18 0x in ?? () 
#19 0x080c19b4 in ?? () 
#20 0x080c19a4 in ?? () 
#21 0x08122ba4 in ?? () 
#22 0xbfb6bfa0 in ?? () 
#23 0x0002 in ?? () 
#24 0x0805592c in run_method () 
#25 0x0017 in ?? () 
#26 0x085c5ce8 in ?? () 
#27 0x0812289c in ?? () 
#28 0x084ce32c in ?? () 
#29 0x0812289c in ?? () 
#30 0xb7f54d32 in add_env_module_vars_unset () 
   from /opt/apache/libexec/mod_env.so 
#31 0x0017 in ?? () 
#32 0x in ?? () 
#33 0x084ce32c in ?? () 
#34 0x085c5ce8 in ?? () 
#35 0x0806f3c1 in process_request_internal () 
#36 0x0812289c in ?? () 
#37 0xb7f4dd68 in ?? () 
#38 0x0001 in ?? () 
#39 0x in ?? () 
#40 0x0812421c in ?? () 
#41 0x080acece in priorities () 
#42 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#43 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#44 0x08050051 in _start () 
at ../sysdeps/i386/elf/start.S:102



[2006-07-05 18:11:23] [EMAIL PROTECTED]

strace does not add any value.
But GDB backtrace could do that.
See this link http://bugs.php.net/bugs-generating-backtrace.php



[2006-07-05 18:06:29] baco at infomaniak dot ch

New strace of previous code 
 
open(/home/www/29212ea8a58d20e52ba0886bd64685bb/web/test.php, 
O_RDONLY) = 7 
fstat64(7, {st_mode=S_IFREG|0644, st_size=235, ...}) = 0 
lseek(7, 0, SEEK_CUR)   = 0 
read(7, ?php\n\t$data = \'?xml version=\1..., 8192) = 
235 
read(7, , 8192)   = 0 
read(7, , 8192)   = 0 
brk(0)  = 0x85f2000 
brk(0x8613000)  = 0x8613000 
close(7)= 0 
--- SIGSEGV (Segmentation fault) @ 0 (0) --- 
chdir(/opt/apache)= 0 
rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 
getpid()= 29068 
kill(29068, SIGSEGV)= 0

#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

This can also reproduce the bug 
so now I will remove one by one... until the rabbit ;-) 
 
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
'--disable-all' '--enable-libxml' '--with-libxml-dir'  
'--enable-dom' '--with-xpm-dir' '--enable-simplexml'  
'--enable-xml' '--with-libexpat-dir' '--with-xmlrpc'  
  
N.B. We are using Apache 1.3.36


Previous Comments:


[2006-07-05 18:54:14] [EMAIL PROTECTED]

Yeah, that's what I thought - please try to add configure options one
by one and see which one causes the problem.
Hint: I suspect it could be --with-curl or --with-openssl.



[2006-07-05 18:48:16] baco at infomaniak dot ch

Unable to reproduce the issue with  
  
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
  
So a special configure option do this ... ?!?



[2006-07-05 18:35:11] [EMAIL PROTECTED]

Uhm.. Now THAT doesn't make any sense to me.
What Apache version is that? And which MPM are you using if it's Apache
2? 
Also, please try to remove all those configure options which are not
required to execute this piece of code. 
I guess just ./configure --with-apxs= ... --enable-debug should be
enough.
 



[2006-07-05 18:23:54] baco at infomaniak dot ch

Thanks for the link how-to debug PHP because with first 
method I wasn't able to have a core file. 
 
gdb bin/httpd 
... 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210309344 (LWP 29253)] 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
 
bt 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
(gdb) bt 
#0  0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
#1  0x0808b76f in XML_Parse () 
#2  0x085f03e4 in ?? () 
#3  0x0039 in ?? () 
#4  0xb78e225e in _emalloc (size=140444644, 
__zend_filename=0xb78a1ac0 
U1À\211å\203ì(\211D$\0301À\211D$\024¸Ç, 
__zend_lineno=0, __zend_orig_filename=0x0, 
__zend_orig_lineno=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend_alloc.c:214

#5  0xb7919aa8 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfb698c0) 
at zend_vm_execute.h:200 
#6  0xb79191c8 in execute (op_array=0x85f009c) at 
zend_vm_execute.h:92 
#7  0xb78fb430 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend.c:1109

#8  0xb78b77c3 in php_execute_script 
(primary_file=0xbfb6bc40) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/main/main.c:1732

#9  0xb796fee9 in apache_php_module_main (r=0x812289c, 
display_source_mode=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/sapi_apache.c:53

#10 0xb7970aca in send_php (r=0x812289c, 
display_source_mode=0, filename=0x0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:661

#11 0xb7970c53 in send_parsed_php (r=0x812289c) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:676

#12 0x08055dff in ap_invoke_handler () 
#13 0x0812289c in ?? () 
#14 0xb7b3f394 in zend_vm_decode.1 () 
from /opt/apache/libexec/libphp5.so 
#15 0x0017 in ?? () 
#16 0x in ?? () 
#17 0x in ?? () 
#18 0x in ?? () 
#19 0x080c19b4 in ?? () 
#20 0x080c19a4 in ?? () 
#21 0x08122ba4 in ?? () 
#22 0xbfb6bfa0 in ?? () 
#23 0x0002 in ?? () 
#24 0x0805592c in run_method () 
#25 0x0017 in ?? () 
#26 0x085c5ce8 in ?? () 
#27 0x0812289c in ?? () 
#28 0x084ce32c in ?? () 
#29 0x0812289c in ?? () 
#30 0xb7f54d32 in add_env_module_vars_unset () 
   from /opt/apache/libexec/mod_env.so 
#31 0x0017 in ?? () 
#32 0x in ?? () 
#33 0x084ce32c in ?? () 
#34 0x085c5ce8 in ?? () 
#35 0x0806f3c1 in process_request_internal () 
#36 0x0812289c in ?? () 
#37 0xb7f4dd68 in ?? () 
#38 0x0001 in ?? () 
#39 0x in ?? () 
#40 0x0812421c in ?? () 
#41 0x080acece in priorities () 
#42 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#43 0xb7dd8974 in __libc_start_main () 
from /lib/tls/libc.so.6 
#44 0x08050051 in _start () 
at ../sysdeps/i386/elf/start.S:102



[2006-07-05 18:11:23] [EMAIL PROTECTED]

strace does not add any value.
But GDB backtrace could do that.
See this link http://bugs.php.net/bugs-generating-backtrace.php

#38017 [Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
 Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

So the answer is mixing together option enable-xml with   
with-libexpat-dir crash PHP when calling  
xml_parser_create().  
 
I hope you can identify the compilation bug now ?? 
 
./configure \ 
--prefix=${PREFIX} \ 
--mandir=/usr/share/man \ 
--with-apxs=/opt/apache/bin/apxs \ 
--enable-debug \ 
--disable-all \ 
--enable-xml \ 
--enable-libxml \ 
\ 
--with-libexpat-dir   
 
$ dpkg -l | grep expat 
ii  libexpat1  1.95.8-3   XML parsing C library - 
runtime library 
 
$ dpkg -l | grep expat 
ii  libexpat1  1.95.8-3   XML parsing C library - 
runtime library 
ii  libexpat1-dev  1.95.8-3   XML parsing C library - 
development kit


Previous Comments:


[2006-07-05 19:02:19] baco at infomaniak dot ch

This can also reproduce the bug 
so now I will remove one by one... until the rabbit ;-) 
 
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
'--disable-all' '--enable-libxml' '--with-libxml-dir'  
'--enable-dom' '--with-xpm-dir' '--enable-simplexml'  
'--enable-xml' '--with-libexpat-dir' '--with-xmlrpc'  
  
N.B. We are using Apache 1.3.36



[2006-07-05 18:54:14] [EMAIL PROTECTED]

Yeah, that's what I thought - please try to add configure options one
by one and see which one causes the problem.
Hint: I suspect it could be --with-curl or --with-openssl.



[2006-07-05 18:48:16] baco at infomaniak dot ch

Unable to reproduce the issue with  
  
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
  
So a special configure option do this ... ?!?



[2006-07-05 18:35:11] [EMAIL PROTECTED]

Uhm.. Now THAT doesn't make any sense to me.
What Apache version is that? And which MPM are you using if it's Apache
2? 
Also, please try to remove all those configure options which are not
required to execute this piece of code. 
I guess just ./configure --with-apxs= ... --enable-debug should be
enough.
 



[2006-07-05 18:23:54] baco at infomaniak dot ch

Thanks for the link how-to debug PHP because with first 
method I wasn't able to have a core file. 
 
gdb bin/httpd 
... 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1210309344 (LWP 29253)] 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
 
bt 
0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
(gdb) bt 
#0  0xb7e3d07f in memcpy () from /lib/tls/libc.so.6 
#1  0x0808b76f in XML_Parse () 
#2  0x085f03e4 in ?? () 
#3  0x0039 in ?? () 
#4  0xb78e225e in _emalloc (size=140444644, 
__zend_filename=0xb78a1ac0 
U1À\211å\203ì(\211D$\0301À\211D$\024¸Ç, 
__zend_lineno=0, __zend_orig_filename=0x0, 
__zend_orig_lineno=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend_alloc.c:214

#5  0xb7919aa8 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfb698c0) 
at zend_vm_execute.h:200 
#6  0xb79191c8 in execute (op_array=0x85f009c) at 
zend_vm_execute.h:92 
#7  0xb78fb430 in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/Zend/zend.c:1109

#8  0xb78b77c3 in php_execute_script 
(primary_file=0xbfb6bc40) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/main/main.c:1732

#9  0xb796fee9 in apache_php_module_main (r=0x812289c, 
display_source_mode=0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/sapi_apache.c:53

#10 0xb7970aca in send_php (r=0x812289c, 
display_source_mode=0, filename=0x0) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:661

#11 0xb7970c53 in send_parsed_php (r=0x812289c) 

at
/tmp/INFOMANIAK/BUILD/php-5.1.4/20060705185658/php-5.1.4/sapi/apache/mod_php5.c:676

#12 0x08055dff in ap_invoke_handler () 
#13 0x0812289c in ?? () 
#14 0xb7b3f394 in zend_vm_decode.1 () 
from /opt/apache/libexec/libphp5.so 
#15 0x0017 in ?? () 
#16 0x in ?? () 
#17 0x in ?? () 
#18 0x in ?? () 
#19 0x080c19b4 in ?? () 
#20 0x080c19a4 in ?? () 
#21 0x08122ba4 in ?? () 
#22 0xbfb6bfa0 in ?? () 
#23 0x0002 in ?? () 
#24 0x0805592c in run_method () 
#25 0x0017 in ?? () 
#26 0x085c5ce8 in ?? () 
#27 0x0812289c in ?? () 
#28 0x084ce32c in ?? () 
#29 0x0812289c in ?? () 
#30 0xb7f54d32 in add_env_module_vars_unset () 
   from /opt/apache/libexec/mod_env.so 
#31 0x0017 in ?? () 
#32

#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

Same issue with 
5e8837ebfe06a3d9b121e763ee34a969 php5.2-latest.tar.gz (200607051830)

So to help you to analyse the problem with 
--enable-xml --enable-libxml --with-libexpat-dir

I have pushed files to

http://imu77.infomaniak.ch/baco/

php5.2-200607051830-output.log -- the output of my compilation script
php5.2-200607051830.tar.gz -- the php source with compiled objects on
Debian Sarge and all Makefile generated by configure.

I cannot do more. Our issue is resolved by removing with-libexpat-dir
but the bug still present if libexpat used on our server.


Previous Comments:


[2006-07-05 19:49:23] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip





[2006-07-05 19:49:10] [EMAIL PROTECTED]

--with-libexpat-dir option has been deprecated years ago and there is
no sense in using it if you have libxml in your system.
Also, it works just fine here.



[2006-07-05 19:28:16] baco at infomaniak dot ch

So the answer is mixing together option enable-xml with   
with-libexpat-dir crash PHP when calling  
xml_parser_create().  
 
I hope you can identify the compilation bug now ?? 
 
./configure \ 
--prefix=${PREFIX} \ 
--mandir=/usr/share/man \ 
--with-apxs=/opt/apache/bin/apxs \ 
--enable-debug \ 
--disable-all \ 
--enable-xml \ 
--enable-libxml \ 
\ 
--with-libexpat-dir   
 
$ dpkg -l | grep expat 
ii  libexpat1  1.95.8-3   XML parsing C library - 
runtime library 
 
$ dpkg -l | grep expat 
ii  libexpat1  1.95.8-3   XML parsing C library - 
runtime library 
ii  libexpat1-dev  1.95.8-3   XML parsing C library - 
development kit



[2006-07-05 19:02:19] baco at infomaniak dot ch

This can also reproduce the bug 
so now I will remove one by one... until the rabbit ;-) 
 
'./configure' '--prefix=/opt/php' '--mandir=/usr/share/man'  
'--with-apxs=/opt/apache/bin/apxs' '--enable-debug'  
'--disable-all' '--enable-libxml' '--with-libxml-dir'  
'--enable-dom' '--with-xpm-dir' '--enable-simplexml'  
'--enable-xml' '--with-libexpat-dir' '--with-xmlrpc'  
  
N.B. We are using Apache 1.3.36



[2006-07-05 18:54:14] [EMAIL PROTECTED]

Yeah, that's what I thought - please try to add configure options one
by one and see which one causes the problem.
Hint: I suspect it could be --with-curl or --with-openssl.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/38017

-- 
Edit this bug report at http://bugs.php.net/?id=38017edit=1


#38017 [Fbk-Opn]: Segfault on xml_parser_create() call

2006-07-05 Thread baco at infomaniak dot ch
 ID:   38017
 User updated by:  baco at infomaniak dot ch
 Reported By:  baco at infomaniak dot ch
-Status:   Feedback
+Status:   Open
 Bug Type: XML related
 Operating System: Linux Debian Sarge
 PHP Version:  5.1.4
 New Comment:

it look the same

./configure \
--prefix=${PREFIX} \
--mandir=/usr/share/man \
--with-apxs=/opt/apache/bin/apxs \
--enable-debug \
--disable-all \
--enable-xml \
--enable-libxml \
\
--with-libexpat-dir

$ gdb /opt/apache/bin/httpd 
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for
details.
This GDB was configured as i386-linux...Using host libthread_db
library /lib/tls/libthread_db.so.1.

(gdb) run -X
Starting program: /opt/apache/bin/httpd -X


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210223328 (LWP 31545)]
0xb7e52077 in memcpy () from /lib/tls/libc.so.6
(gdb) 

#0  0xb7e52077 in memcpy () from /lib/tls/libc.so.6
#1  0x0808b76f in XML_Parse ()
#2  0x0853b3c4 in ?? ()
#3  0x0039 in ?? ()
#4  0xb7c1314b in _array_init (arg=0x4, __zend_filename=0x852ec3c ,
__zend_lineno=0)
at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/Zend/zend_API.c:821
#5  0xb7c32e04 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbff80430) at zend_vm_execute.h:200
#6  0xb7c361a4 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0xbff80430) at zend_vm_execute.h:1642
#7  0xb7c329bb in execute (op_array=0x853b1d4) at zend_vm_execute.h:92
#8  0xb7c10f81 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/Zend/zend.c:1110
#9  0xb7bc5fe6 in php_execute_script (primary_file=0xbff827f0) at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/main/main.c:1748
#10 0xb7c7f0a7 in apache_php_module_main (r=0x812289c,
display_source_mode=0)
at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/sapi/apache/sapi_apache.c:53
#11 0xb7c7ff1b in send_php (r=0x812289c, display_source_mode=0,
filename=0x81245b4
/home/www/555a1d69b0f4be4d6259cd00910c8ce1/web/baco/test.php)
at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/sapi/apache/mod_php5.c:665
#12 0xb7c7ff6f in send_parsed_php (r=0x812289c) at
/tmp/INFOMANIAK/BUILD/php5.2-200607051830/20060705223915/php5.2-200607051830/sapi/apache/mod_php5.c:680
#13 0x08055dff in ap_invoke_handler ()
#14 0x0812289c in ?? ()
#15 0xb7d05689 in zend_vm_decode.1 () from
/opt/apache/libexec/libphp5.so
#16 0x0017 in ?? ()
#17 0x in ?? ()
#18 0x in ?? ()
#19 0x in ?? ()
#20 0x080c19b4 in ?? ()
#21 0x080c19a4 in ?? ()
#22 0x08122ba4 in ?? ()
#23 0xbff82b90 in ?? ()
#24 0x0002 in ?? ()
#25 0x0805592c in run_method ()
#26 0x0017 in ?? ()
#27 0x08513138 in ?? ()
#28 0x0812289c in ?? ()
#29 0x083cac3c in ?? ()
#30 0x0812289c in ?? ()
#31 0xb7f69d32 in add_env_module_vars_unset () from
/opt/apache/libexec/mod_env.so
#32 0x0017 in ?? ()
#33 0x in ?? ()
#34 0x083cac3c in ?? ()
#35 0x08513138 in ?? ()
#36 0x0806f3c1 in process_request_internal ()
#37 0x0812289c in ?? ()
#38 0x080af210 in status_lines ()
#39 0xbff82d18 in ?? ()
#40 0x080515ff in ap_table_get ()
#41 0x08124224 in ?? ()
#42 0x080acece in priorities ()
#43 0xb7ded974 in __libc_start_main () from /lib/tls/libc.so.6
#44 0xb7ded974 in __libc_start_main () from /lib/tls/libc.so.6
#45 0x08050051 in _start () at ../sysdeps/i386/elf/start.S:102
(gdb)


Previous Comments:


[2006-07-05 21:13:23] [EMAIL PROTECTED]

Did the GDB backtrace change when you removed all those ./configure
options ?



[2006-07-05 21:01:41] baco at infomaniak dot ch

Same issue with 
5e8837ebfe06a3d9b121e763ee34a969 php5.2-latest.tar.gz (200607051830)

So to help you to analyse the problem with 
--enable-xml --enable-libxml --with-libexpat-dir

I have pushed files to

http://imu77.infomaniak.ch/baco/

php5.2-200607051830-output.log -- the output of my compilation script
php5.2-200607051830.tar.gz -- the php source with compiled objects on
Debian Sarge and all Makefile generated by configure.

I cannot do more. Our issue is resolved by removing with-libexpat-dir
but the bug still present if libexpat used on our server.



[2006-07-05 19:49:23] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

#37221 [NEW]: enable-sigchild cause ERROR: `phpize' failed

2006-04-27 Thread baco at infomaniak dot ch
From: baco at infomaniak dot ch
Operating system: Linux 2.6 (Debian Sarge)
PHP version:  5.1.2
PHP Bug Type: Compile Failure
Bug description:  enable-sigchild cause ERROR: `phpize' failed

Description:

When trying to install or upgrade a package   
using   
 
pear install pecl/ 
 
The pear return the following error message : 

ERROR: `phpize' failed 
   
If I build the module by hand without using install  
it works. 
 
/opt/php/bin/pear download pecl/ 
tar xzpvf .tar.gz 
cd  
phpize 
make all 
./configure \ 
--with-php-config=.../php-config 

After some research I found a bug in function  
PEAR_Builder::_runCommand() from PEAR/Builder.php  
who return a bad exitcode from pclose(). 
  
One more time compile PHP using enable-sigchild cause 
trouble with pclose() return code (-1). 

Reproduce code:
---
See also http://pear.php.net/bugs/bug.php?id=1852

bug in function PEAR_Builder::_runCommand()

$ /opt/php/bin/pear install pecl/zip
downloading zip-1.0.tgz ...
Starting to download zip-1.0.tgz (4,930 bytes)
.done: 4,930 bytes
3 source files, building
running: phpize
ERROR: failed to run `phpize'

Expected result:

AFTER PATCHED PEAR/Builder.php or compile PHP without  
enable-sigchild.  
 
--- /opt/php/lib/php/PEAR/Builder.php   2006-04-26 
16:18:12.0 +0200 
+++ /opt/php/lib/php/PEAR/Builder.php   2006-04-27 
11:56:13.201667500 +0200 
@@ -432,6 +432,7 @@ 
 $callback[0]-debug = $olddbg; 
 } 
 $exitcode = @pclose($pp); 
+$exitcode = 0; 
 return ($exitcode == 0); 
 } 
 
$ strace /opt/php/bin/php -C -q -d
include_path=/opt/php/lib/php -d
output_buffering=1 /opt/php/lib/php/pearcmd.php install
pecl/zip2 after.txt
downloading zip-1.0.tgz ...
Starting to download zip-1.0.tgz (4,930 bytes)
.done: 4,930 bytes
3 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No:  20050922
Zend Extension Api No:   220051025
building in /var/tmp/pear-build-root/zip-1.0
running: /tmp/tmpbJ5ZjW/zip-1.0/configure
checking for egrep... grep -E
checking for a sed that does not truncate
output... /bin/sed
...


Actual result:
--
$ strace /opt/php/bin/php -C -q -d 
include_path=/opt/php/lib/php -d 
output_buffering=1 /opt/php/lib/php/pearcmd.php install 
pecl/zip2 before.txt 
downloading zip-1.0.tgz ... 
Starting to download zip-1.0.tgz (4,930 bytes) 
.done: 4,930 bytes 
3 source files, building 
running: phpize 
Configuring for: 
PHP Api Version: 20041225 
Zend Module Api No:  20050922 
Zend Extension Api No:   220051025 
ERROR: `phpize' failed 

-- 
Edit bug report at http://bugs.php.net/?id=37221edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37221r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37221r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37221r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37221r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=37221r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=37221r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=37221r=needscript
Try newer version:http://bugs.php.net/fix.php?id=37221r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=37221r=support
Expected behavior:http://bugs.php.net/fix.php?id=37221r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=37221r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=37221r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37221r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37221r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37221r=dst
IIS Stability:http://bugs.php.net/fix.php?id=37221r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=37221r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37221r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=37221r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=37221r=mysqlcfg