#35926 [NEW]: Strange configuration behavior, gdb reports corrupt stack
| From: | jeff95350 at yahoo dot com | Date: | Sat, 07 Jan 2006 21:41:32 +0000 |
| Subject: | #35926 [NEW]: Strange configuration behavior, gdb reports corrupt stack | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-91647@lists.php.net to get a copy of this message | ||
From: jeff95350 at yahoo dot com
Operating system: FreeBSD 5.4
PHP version: 4.4.1
PHP Bug Type: *Configuration Issues
Bug description: Strange configuration behavior, gdb reports corrupt stack
Description:
------------
PHP 4.4.1 seems to behave strangely when looking for the config file.
Below I have an example that appears to be contradictory, or at least
extremely unintuitive. PHP reports that it is using a certain
configuration file, but then ignores the contents. When I specify the
configuration file directly, it works fine.
While investigating, I also show GDB reporting a corrupted stack.
Reproduce code:
---------------
$ pwd
/home/admin/install
$ rm -rf php-4.4.1/
$ tar jxf ../download/php-4.4.1.tar.bz2
$ cd php-4.4.1/
$ ./configure --prefix=/usr/local/admin
--with-config-file-path=/usr/local/admin/etc/php.ini
--with-config-file-scan-dir=/usr/local/admin/etc/php --with-pgsql
--with-mysql --with-curl --with-gd --enable-fastcgi --with-openssl
--with-zlib --enable-bcmath --with-bz2 --enable-calendar --enable-dba
--with-db4 --with-mhash --with-mcrypt
$ make && make install
$ grep pgsql.allow_persistent /usr/local/admin/etc/php.ini
pgsql.allow_persistent = Off
$ /usr/local/admin/bin/php -i | grep Configuration
<tr><td class="e">Configuration File (php.ini) Path </td><td
class="v">/usr/local/admin/etc/php.ini </td></tr>
<h1>Configuration</h1>
Notice that php reports that it is using the config file
"/usr/local/admin/etc/php.ini", and that that config file has
pgsql.allow_persistent = Off.
Expected result:
----------------
$ /usr/local/admin/bin/php -i | grep pgsql.allow_persistent
<tr><td class="e">pgsql.allow_persistent</td><td
class="v">Off</td><td
class="v">Off</td></tr>
$ /usr/local/admin/bin/php -i \
-c /usr/local/admin/etc/php.ini \
| grep pgsql.allow_persistent
<tr><td class="e">pgsql.allow_persistent</td><td
class="v">Off</td><td
class="v">Off</td></tr>
Actual result:
--------------
Notice below how pgsql.allow_persistent is On when the config file says it
should be Off.
$ /usr/local/admin/bin/php -i | grep pgsql.allow_persistent
<tr><td class="e">pgsql.allow_persistent</td><td
class="v">On</td><td
class="v">On</td></tr>
Notice below how the config file obviously works. It's really just the
php.ini-dist with all of the "allow_persistent" settings turned Off. Below
I specify the config file explicitly and it works fine.
$ /usr/local/admin/bin/php -i \
-c /usr/local/admin/etc/php.ini \
| grep pgsql.allow_persistent
<tr><td class="e">pgsql.allow_persistent</td><td
class="v">Off</td><td
class="v">Off</td></tr>
While investigating the problem, I saw some strange results from gdb:
$ gdb /usr/local/admin/bin/php
GNU gdb 6.1.1 [FreeBSD]
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-marcel-freebsd"...
(gdb) set args "-i"
(gdb) break php_init_config
Breakpoint 1 at 0x81468b8: file
/home/admin/install/php-4.4.1/main/php_ini.c, line 251.
(gdb) run
Starting program: /usr/local/admin/bin/php "-i"
Breakpoint 1, php_init_config ()
at /home/admin/install/php-4.4.1/main/php_ini.c:251
251 zend_file_handle fh = {0};
(gdb) watch free_ini_search_path
Hardware watchpoint 2: free_ini_search_path
(gdb) continue
Continuing.
Hardware watchpoint 2: free_ini_search_path
Old value = 0
New value = 1
php_init_config () at /home/admin/install/php-4.4.1/main/php_ini.c:288
288 php_ini_search_path[0] = 0;
(gdb) step
295 if (env_location[0]) {
(gdb)
315 if (strcmp(sapi_module.name, "cli") != 0) {
(gdb)
316 if (*php_ini_search_path) {
(gdb)
319 strcat(php_ini_search_path, ".");
(gdb)
331 if (sapi_module.executable_location) {
(gdb)
332 binary_location =
estrdup(sapi_module.executable_location);
(gdb)
_estrdup (s=0x81bed31 "i-fcgi")
at /home/admin/install/php-4.4.1/Zend/zend_alloc.c:360
360 {
(gdb) finish
Run till exit from #0 _estrdup (s=0x81bed31 "i-fcgi")
at /home/admin/install/php-4.4.1/Zend/zend_alloc.c:360
0x08146e94 in php_init_config ()
at /home/admin/install/php-4.4.1/main/php_ini.c:332
332 binary_location =
estrdup(sapi_module.executable_location);
Value returned is $1 = 0x822304c "/usr/local/admin/bin/php"
(gdb) step
337 if (binary_location) {
(gdb)
332 binary_location =
estrdup(sapi_module.executable_location);
(gdb)
337 if (binary_location) {
(gdb)
338 char *separator_location =
strrchr(binary_location, DEFAULT_SLASH);
(gdb)
Error evaluating expression for watchpoint 2
Previous frame identical to this frame (corrupt stack?)
Watchpoint 2 deleted.
0x281c7b07 in r_debug_state () from /libexec/ld-elf.so.1
(gdb)
It looks like there's some kind of problem there, since gdb says "corrupt
stack". I'm not particularly good with gdb, so maybe there's nothing wrong
with PHP.
--
Edit bug report at http://bugs.php.net/?id=35926&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35926&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35926&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35926&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35926&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35926&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35926&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35926&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35926&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35926&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35926&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35926&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35926&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35926&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35926&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35926&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35926&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35926&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35926&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35926&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35926&r=mysqlcfg