com php-src: Fixed crash: ext/session/session.c
| From: | Yasuo Ohgaki | Date: | Tue, 27 Jan 2015 23:03:37 +0000 |
| Subject: | com php-src: Fixed crash: ext/session/session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84431@lists.php.net to get a copy of this message | ||
Commit: feeaaa4c3fe68bfcc3a2e3c096b246aa69cc048b
Author: Yasuo Ohgaki <yohgaki@php.net> Wed, 28 Jan 2015 08:03:37 +0900
Parents: b45872c2ec9e9ea685807530719a364f5e01c17e
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=feeaaa4c3fe68bfcc3a2e3c096b246aa69cc048b
Log:
Fixed crash
Changed paths:
M ext/session/session.c
Diff:
diff --git a/ext/session/session.c b/ext/session/session.c
index c2ec373..9c995b6 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2203,24 +2203,26 @@ static PHP_FUNCTION(session_start)
/* set options */
if (options) {
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_idx, str_idx, value) {
- switch(Z_TYPE_P(value)) {
- case IS_STRING:
- case IS_TRUE:
- case IS_FALSE:
- case IS_LONG:
- if (!zend_string_equals_literal(str_idx, "read_and_close")) {
- convert_to_boolean(value);
- read_and_close = (Z_TYPE_P(value) == IS_TRUE) ? 1 : 0;
- } else {
- convert_to_string(value);
- if (php_session_start_set_ini(str_idx, Z_STR_P(value)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Setting option '%s' failed",
str_idx->val);
+ if (str_idx) {
+ switch(Z_TYPE_P(value)) {
+ case IS_STRING:
+ case IS_TRUE:
+ case IS_FALSE:
+ case IS_LONG:
+ if (zend_string_equals_literal(str_idx, "read_and_close")) {
+ convert_to_boolean(value);
+ read_and_close = (Z_TYPE_P(value) == IS_TRUE) ? 1 : 0;
+ } else {
+ convert_to_string(value);
+ if (php_session_start_set_ini(str_idx, Z_STR_P(value)) == FAILURE) {
+ php_error_docref(NULL, E_WARNING, "Setting option '%s' failed",
str_idx->val);
+ }
}
- }
- break;
- default:
- php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or
long", str_idx->val);
- break;
+ break;
+ default:
+ php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or
long", str_idx->val);
+ break;
+ }
}
} ZEND_HASH_FOREACH_END();
}