Hello,

We have several places in our code (specificly in browscap.c) where we have bugs due to either improper usage of INI_STR, or improper results from zend_ini.c:zend_ini_string.

The code:

if (INI_STR("browscap")) {
zend_hash_destroy(&browser_hash);
}

Will fail if there is no 'browscap' entry in php.ini since zend_ini_string returns "". Adding 'browscap = ;' to php.ini fixes that, but causes an error on startup because the init cannot open ''.

The fix would be:

char *browscap = INI_STR("browscap");
if (browscap && *browscap) {
zend_hash_destroy(&browser_hash);
}

A quick search in the code shows we have this problem in several places (php_imap.c, browscap.c, mail.c, sendmail.c, possibly more depending on usage of variables).

For some reason, this but only sporadicaly appears for me, but most often does when loading (any) debugger extension on linux. In the case of the browscap, I actually get a segfault in the mshutdown.

So, is it improper usage of INI_STR, or is it incorrect results from zend_ini_string? I'd like to get these fixed for 4.3.1.

Shane





--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to