Re: com php-src: Fixed Bug #65315 session.hash_function silently fallback to default md5: NEWS ext/session/session.c
ext/session/tests/session_hash_function_basic.phpt
| From: | Laruence | Date: | Thu, 29 Aug 2013 06:22:12 +0000 |
| Subject: | Re: com php-src: Fixed Bug #65315 session.hash_function silently fallback to default md5: NEWS ext/session/session.c ext/session/tests/session_hash_function_basic.phpt |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-73122@lists.php.net to get a copy of this message | ||
Hey:
I got this test script failed in my box:
$ cat ext/session/tests/session_hash_function_basic.diff
005+ string(26) "9gjghoikm8eo1lvau5euuh8q61"
005- string(32) "%s"
010+ string(32) "jkdcvp3tf1ptsgof9edi515jsbh5p92o"
010- string(40) "%s"
017+ string(32) "ecdatafpdf4urjjrje6ver0o87i3hoe8"
017- string(40) "%s"
I am not sure whether the length of the string is must be a fixed
len, so I leave it to you
thanks
On Fri, Aug 9, 2013 at 5:05 PM, Yasuo Ohgaki <yohgaki@php.net> wrote:
> Commit: b6b425d2cf767e47e9d05fbfe1328f1485a488ef
> Author: Yasuo Ohgaki <yohgaki@php.net> Fri, 9 Aug 2013 18:05:07 +0900
> Parents: c53b425763d4cdbc9dc5708e22c6517dfd5e1e09
> Branches: master
>
> Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=b6b425d2cf767e47e9d05fbfe1328f1485a488ef
>
> Log:
> Fixed Bug #65315 session.hash_function silently fallback to default md5
>
> Bugs:
> https://bugs.php.net/65315
>
> Changed paths:
> M NEWS
> M ext/session/session.c
> A ext/session/tests/session_hash_function_basic.phpt
>
>
> Diff:
> diff --git a/NEWS b/NEWS
> index c679b90..02fa05e 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -7,6 +7,10 @@ PHP
> NEWS
> . Implemented internal operator overloading
> (RFC: https://wiki.php.net/rfc/operator_overloading_gmp).
> (Nikita)
>
> +- Session:
> + . Fixed Bug #65315 (session.hash_function silently fallback to default md5)
> + (Yasuo)
> +
> - mysqlnd:
> . Disabled flag for SP OUT variables for 5.5+ servers as they are not natively
> supported by the overlying APIs. (Andrey)
> diff --git a/ext/session/session.c b/ext/session/session.c
> index c02a10d..aee3308 100644
> --- a/ext/session/session.c
> +++ b/ext/session/session.c
> @@ -727,6 +727,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
> }
> #endif /* HAVE_HASH_EXT }}} */
>
> + php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration
> 'session.hash_function' must be existing hash function. %s does not exist.",
> new_value);
> return FAILURE;
> }
> /* }}} */
> diff --git a/ext/session/tests/session_hash_function_basic.phpt
> b/ext/session/tests/session_hash_function_basic.phpt
> new file mode 100644
> index 0000000..8b14a88
> --- /dev/null
> +++ b/ext/session/tests/session_hash_function_basic.phpt
> @@ -0,0 +1,50 @@
> +--TEST--
> +Test session.hash_function ini setting : basic functionality
> +--SKIPIF--
> +<?php include('skipif.inc'); ?>
> +--FILE--
> +<?php
> +
> +ob_start();
> +
> +echo "*** Testing session.hash_function : basic functionality ***\n";
> +
> +var_dump(ini_set('session.hash_function', 'md5'));
> +var_dump(session_start());
> +var_dump(!empty(session_id()), session_id());
> +var_dump(session_destroy());
> +
> +var_dump(ini_set('session.hash_function', 'sha1'));
> +var_dump(session_start());
> +var_dump(!empty(session_id()), session_id());
> +var_dump(session_destroy());
> +
> +var_dump(ini_set('session.hash_function', 'none')); // Should fail
> +var_dump(session_start());
> +var_dump(!empty(session_id()), session_id());
> +var_dump(session_destroy());
> +
> +
> +echo "Done";
> +ob_end_flush();
> +?>
> +--EXPECTF--
> +*** Testing session.hash_function : basic functionality ***
> +string(1) "0"
> +bool(true)
> +bool(true)
> +string(32) "%s"
> +bool(true)
> +string(3) "md5"
> +bool(true)
> +bool(true)
> +string(40) "%s"
> +bool(true)
> +
> +Warning: ini_set(): session.hash_func must be existing hash function. none does not exist. in
> %s/session_hash_function_basic.php on line 17
> +bool(false)
> +bool(true)
> +bool(true)
> +string(40) "%s"
> +bool(true)
> +Done
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Laruence Xinchen Hui
http://www.laruence.com/