Re: PHP_INI_MH()'s new_value_length being non-zero for NULL new_value?
| From: | Yasuo Ohgaki | Date: | Wed, 07 Sep 2016 09:19:46 +0000 |
| Subject: | Re: PHP_INI_MH()'s new_value_length being non-zero for NULL new_value? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95722@lists.php.net to get a copy of this message | ||
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