php.net |  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
 [2003-07-30 01:56 UTC] herouth at itouch dot co dot il
Description:
------------
PHP CLI crashes (segfault) when locale environment variables.
For example:
$ unset LC_ALL
$ export LANG=en_US
$ php -v
Segmentation fault (core dumped)
$ LANG=C
$ 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
$


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] iliaa@php.net
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/libc.so.6 
#1  0xb1914044 in ?? () 
Cannot access memory at address 0x6840445d 
(gdb)
 [2003-07-31 07:21 UTC] iliaa@php.net
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] sniper@php.net
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 
problem. 
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] sniper@php.net
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] sniper@php.net
I can not reproduce this. I used this configure line:

'./configure' \
'--disable-all' \
'--disable-cgi' \
'--enable-debug' \
'--with-sybase-ct=/opt/sybase-11.9.2/'

Try the same, using latest stable CVS snapshot.

 [2003-08-05 11:45 UTC] moriyoshi@php.net
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] sniper@php.net
Answer for the problem you're seeing can be found here:

http://www.mbay.net/~mpeppler/Linux-ASE-FAQ.html#q1.15

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

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat May 25 15:01:27 2019 UTC