diff --git a/configs/ini.c b/configs/ini.c index a260ecc0..e4c382ee 100644 --- a/configs/ini.c +++ b/configs/ini.c @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ini.c 327425 2012-09-02 03:58:49Z laruence $ */ +/* $Id: ini.c 327591 2012-09-10 10:56:13Z laruence $ */ zend_class_entry *yaf_config_ini_ce; @@ -548,9 +548,13 @@ yaf_config_t * yaf_config_ini_instance(yaf_config_t *this_ptr, zval *filename, z return NULL; } } + } else { + zval_ptr_dtor(&configs); + yaf_trigger_error(E_ERROR TSRMLS_CC, "Argument is not a valid ini file '%s'", ini_file); + return NULL; } } else { - efree(configs); + zval_ptr_dtor(&configs); yaf_trigger_error(E_ERROR TSRMLS_CC, "Unable to find config file '%s'", ini_file); return NULL; } diff --git a/requests/simple.c b/requests/simple.c index dfe5e6ae..0e867fe9 100644 --- a/requests/simple.c +++ b/requests/simple.c @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simple.c 327580 2012-09-10 06:31:34Z laruence $ */ +/* $Id: simple.c 327591 2012-09-10 10:56:13Z laruence $ */ static zend_class_entry *yaf_request_simple_ce; @@ -30,7 +30,7 @@ yaf_request_t * yaf_request_simple_instance(yaf_request_t *this_ptr, zval *modul object_init_ex(instance, yaf_request_simple_ce); } - if (!method) { + if (!method || IS_STRING != Z_TYPE_P(method)) { MAKE_STD_ZVAL(method); if (!SG(request_info).request_method) { if (!strncasecmp(sapi_module.name, "cli", 3)) { diff --git a/tests/054.phpt b/tests/054.phpt new file mode 100644 index 00000000..b2eb60db --- /dev/null +++ b/tests/054.phpt @@ -0,0 +1,24 @@ +--TEST-- +check for Various segfault +--SKIPIF-- + +--INI-- +yaf.use_spl_autoload=0 +yaf.lowcase_path=0 +--FILE-- +getMessage()); +} + +$request = new Yaf_Request_Simple(NULL); +var_dump($request->isOptions()); + +echo "okey"; +?> +--EXPECTF-- +string(%d) "Argument is not a valid ini file '%s'" +bool(false) +okey diff --git a/yaf_request.h b/yaf_request.h index 168d9bc1..0ed29dba 100644 --- a/yaf_request.h +++ b/yaf_request.h @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: yaf_request.h 327552 2012-09-09 03:52:28Z laruence $ */ +/* $Id: yaf_request.h 327591 2012-09-10 10:56:13Z laruence $ */ #ifndef YAF_REQUEST_H #define YAF_REQUEST_H @@ -44,7 +44,7 @@ #define YAF_REQUEST_IS_METHOD(x) \ PHP_METHOD(yaf_request, is##x) {\ - zval * method = zend_read_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL(YAF_REQUEST_PROPERTY_NAME_METHOD), 1 TSRMLS_CC);\ + zval * method = zend_read_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL(YAF_REQUEST_PROPERTY_NAME_METHOD), 0 TSRMLS_CC);\ if (strncasecmp(#x, Z_STRVAL_P(method), Z_STRLEN_P(method)) == 0) { \ RETURN_TRUE; \ } \