|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24866 PHP CLI crashes when locale has certain values
Submitted: 2003-07-30 01:56 UTC Modified: 2003-08-05 18:30 UTC
From: herouth at itouch dot co dot il Assigned:
Status: Not a bug Package: Sybase-ct (ctlib) related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: herouth at itouch dot co dot il
New email:
PHP Version: OS:


 [2003-07-30 01:56 UTC] herouth at itouch dot co dot il
PHP CLI crashes (segfault) when locale environment variables.
For example:
$ unset LC_ALL
$ export LANG=en_US
$ php -v
Segmentation fault (core dumped)
$ php -v
PHP 4.3.2 (cli) (built: Jul  6 2003 17:00:52)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-30 02:40 UTC] herouth at itouch dot co dot il
Tested with CVS snapshot. Same result.
 [2003-07-30 02:44 UTC] herouth at itouch dot co dot il
Additional information - config parameters used when compiling 
this CLI PHP: 
'./configure' \ 
'--prefix=/opt/php' \ 
'--with-sybase-ct=/opt/sybase-11.9.2/' \ 
'--with-imap' \ 
'--without-pear' \ 
'--without-mysql' \ 
'--enable-ftp' \ 
'--with-curl=/usr/local' \ 
'--with-dom=/usr/local' \ 
'--with-zlib-dir=/usr' \ 
'--with-iconv' \ 
'--enable-sockets' \ 
'--disable-cgi' \ 
 [2003-07-30 12:36 UTC]
Can you please generate a backtrace. I've tried your example and was unable to replicate the bug.
 [2003-07-31 04:42 UTC] herouth at itouch dot co dot il
I'm not sure whether I'm using the right procedure to do a 
backtrace. Basically, I reconfigured php with CFLAGS=-O0 -g, did 
a make, then ran again, then ran gdb php core, and within gdb, 
did "backtrace". This is all I've got, and if I did it wrong, well, 
correct me. 
(gdb) backtrace 
#0  0x40445d88 in main_arena () from /lib/ 
#1  0xb1914044 in ?? () 
Cannot access memory at address 0x6840445d 
 [2003-07-31 07:21 UTC]
To get the most debug information do the following:
1) Compile php with --enable-debug
2) export CFLAGS=-g3 (optional, but recommended)
 [2003-07-31 07:58 UTC] herouth at itouch dot co dot il
Tried --enable-debug and -g3, same result in gdb. 
Note that crash doesn't happen if running php within gdb.
 [2003-07-31 13:39 UTC]
Does it crash with this:

# rm config.cache && ./configure --disable-all --disable-cgi --enable-debug
# make clean && make
# unset LC_ALL
# export LANG=en_US
# sapi/cli/php -n -v

Don't set any CFLAGS/other compile related settings, PHP configure knows better..
Which linux is this? glibc version?

 [2003-08-03 04:11 UTC] herouth at itouch dot co dot il
I think I pinpointed it. 
I tried your configure/compile sequence and it eliminated the 
I went on and re-compiled using my original configure line, 
except the sybase-ct line. No problem. 
I added the --with-sybase-ct line, and the crash reappeared. 
As for my Linux, it's an old RedHat, kernel 2.2.16-3smp. glibc is, 
I think, 2.1.3.
 [2003-08-04 09:58 UTC]
And I guess it works also when you compile PHP with sybase, but without imap?

 [2003-08-04 10:13 UTC] herouth at itouch dot co dot il
No. Compiling with sybase and without imap has no effect. It still 
crashes with LANG=en_US, and works with LANG=C.
 [2003-08-05 11:14 UTC]
I can not reproduce this. I used this configure line:

'./configure' \
'--disable-all' \
'--disable-cgi' \
'--enable-debug' \

Try the same, using latest stable CVS snapshot.

 [2003-08-05 11:45 UTC]
Is there any application other than PHP that crashes if LANG is set to en_US? That doesn't look like a PHP bug and
probably a glibc bug.

If it really segfaults in main_arena() even outside gdb, one of possible reasons is silent buffer overrun in the heap. Memory block corruption often causes this kind of problem.

 [2003-08-05 18:30 UTC]
Answer for the problem you're seeing can be found here:

That helped me to actually reproduce this too, and to prove it's really not PHP bug.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 20:03:41 2021 UTC