PHP_INI_MH()'s new_value_length being non-zero for NULL new_value?

php.internals

Yasuo Ohgaki

10 years ago
Hi all, I realized that setting default_charset does not set *.internal_encoding/etc. So I looked into what's wrong and found PHP_INI_MH()'s new_value_length being non-zero for NULL new_value. This makes fail to set proper value for *.intermal_encoding/etc. This happens from PHP 5.6 branch. It was 0 for null value otherwise encoding setting was not working from the beginning. Is this change intended or a bug? Or I got zero length during patch development by accident? If this behavior wouldn't be changed, I'll just commit patch that fix the encoding INI issue. Thank you,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Yasuo Ohgaki

10 years ago
On Wed, Sep 7, 2016 at 5:46 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> I realized that setting default_charset does not set > *.internal_encoding/etc. So I looked into what's wrong and found > > PHP_INI_MH()'s new_value_length being non-zero for NULL new_value. > > This makes fail to set proper value for *.intermal_encoding/etc. This > happens from PHP 5.6 branch. It was 0 for null value otherwise > encoding setting was not working from the beginning. > > Is this change intended or a bug? > Or I got zero length during patch development by accident? > > If this behavior wouldn't be changed, I'll just commit patch that fix > the encoding INI issue.
It seems it was by accident. new_value_length would be uninitialized value because of PHPAPI zval *cfg_get_entry(const char *name, uint name_length) { zval *tmp; if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp) == SUCCESS) { return tmp; } else { return NULL; } } when there is no ini definition at all. I'll just fix code inside PHP_INI_MH(). Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net