Re: com php-src: Re-fixed Bug #66481 (Calls to session_name() segfault when session.name is null): NEWS ext/session/session.c
ext/session/tests/bug66481.phpt
| From: | Yasuo Ohgaki | Date: | Thu, 16 Jan 2014 07:18:03 +0000 |
| Subject: | Re: com php-src: Re-fixed Bug #66481 (Calls to session_name() segfault when session.name is null): NEWS ext/session/session.c ext/session/tests/bug66481.phpt |
||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-75648@lists.php.net to get a copy of this message | ||
BTW, there might be more codes that assume users are setting something.
We may better to check php.ini handlers and it's usage in modules.
--
Yasuo Ohgaki
yohgaki@ohgaki.net
On Thu, Jan 16, 2014 at 4:13 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> It's better than previous one.
> Thank you.
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net
>
>
> On Thu, Jan 16, 2014 at 3:41 PM, Xinchen Hui <laruence@php.net> wrote:
>
>> Commit: b777248ded69289b84d645ba2f36dbc207c77ff7
>> Author: Xinchen Hui <laruence@php.net> Thu, 16 Jan 2014
>> 14:41:12 +0800
>> Parents: 271053ad470e4b7f0e1eb46dfc1a4369d5c7baa2
>> Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
>>
>> Link:
>>
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=b777248ded69289b84d645ba2f36dbc207c77ff7
>>
>> Log:
>> Re-fixed Bug #66481 (Calls to session_name() segfault when session.nameis null)
>>
>> Bugs:
>> https://bugs.php.net/66481
>>
>> Changed paths:
>> M NEWS
>> M ext/session/session.c
>> A ext/session/tests/bug66481.phpt
>>
>>
>> Diff:
>> diff --git a/NEWS b/NEWS
>> index cffe5ae..81f88bf 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -5,6 +5,10 @@ PHP
>> NEWS
>> - Core:
>> . Fixed bug #66286 (Incorrect object comparison with inheritance).
>> (Nikita)
>>
>> +- Session:
>> + . Fixed bug #66481 (Calls to session_name() segfault when session.nameis
>> + null). (Laruence)
>> +
>> ?? ??? 2013, PHP 5.4.24
>>
>> - Core:
>> diff --git a/ext/session/session.c b/ext/session/session.c
>> index 35db50a..5b03d63 100644
>> --- a/ext/session/session.c
>> +++ b/ext/session/session.c
>> @@ -618,11 +618,10 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
>> static PHP_INI_MH(OnUpdateName) /* {{{ */
>> {
>> /* Numeric session.name won't work at all */
>> - if (PG(modules_activated) &&
>> - (!new_value_length || is_numeric_string(new_value,
>> new_value_length, NULL, NULL, 0))) {
>> + if ((!new_value_length || is_numeric_string(new_value,
>> new_value_length, NULL, NULL, 0))) {
>> int err_type;
>>
>> - if (stage == ZEND_INI_STAGE_RUNTIME) {
>> + if (stage == ZEND_INI_STAGE_RUNTIME || stage ==
>> ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) {
>> err_type = E_WARNING;
>> } else {
>> err_type = E_ERROR;
>> diff --git a/ext/session/tests/bug66481.phpt
>> b/ext/session/tests/bug66481.phpt
>> new file mode 100644
>> index 0000000..cf6ad6a
>> --- /dev/null
>> +++ b/ext/session/tests/bug66481.phpt
>> @@ -0,0 +1,17 @@
>> +--TEST--
>> +Bug #66481: Calls to session_name() segfault when session.name is null.
>> +--INI--
>> +session.name=
>> +--SKIPIF--
>> +<?php include('skipif.inc'); ?>
>> +--FILE--
>> +<?php
>> +
>> +var_dump(session_name("foo"));
>> +var_dump(session_name("bar"));
>> +--EXPECTF--
>> +PHP Warning: PHP Startup: session.name cannot be a numeric or empty ''
>> in Unknown on line 0
>> +
>> +Warning: PHP Startup: session.name cannot be a numeric or empty '' in
>> Unknown on line 0
>> +string(9) "PHPSESSID"
>> +string(3) "foo"
>>
>>
>> --
>> PHP CVS Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>