diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f49843fefcd..0e72a8c53d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ on: env: # All versions should be declared here - PHALCON_VERSION: 5.0.4 + PHALCON_VERSION: 5.0.5 ZEPHIR_PARSER_VERSION: 1.5.1 ZEPHIR_VERSION: 0.16.3 diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 31c83ef4b1f..57e32aa4229 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,3 +1,12 @@ +# [5.0.5](https://github.com/phalcon/cphalcon/releases/tag/v5.0.5) (xxxx-xx-xx) + +## Fixed +- Fixed `Phalcon\Config\Config::setData` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171) +- Fixed `Phalcon\Config\Adapter\Groupped::__construct` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171) +- Fixed `Phalcon\Session\Manager::setName`, removing the regex check for the name for custom adapters to work with `create_sid()` [#16170](https://github.com/phalcon/cphalcon/issues/16170) +- Fixed `PdoResult::fetchAll` when passed class name in 2nd argument [#16177](https://github.com/phalcon/cphalcon/issues/16177) +- Fixed `Forms\Form::label` to accept an array as a default variable [#16180](https://github.com/phalcon/cphalcon/issues/16180) + # [5.0.4](https://github.com/phalcon/cphalcon/releases/tag/v5.0.4) (2022-10-17) ## Fixed diff --git a/README.md b/README.md index 91d88c305d5..fe9e00c063a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ You can either download a binary package for the system of your choice or build ## Installation -For detailed installation instructions you can check our [installation](https://docs.phalcon.io/4.0/en/installation) page in the docs. +For detailed installation instructions you can check our [installation](https://docs.phalcon.io/5.0/en/installation) page in the docs. ## Generating API Documentation @@ -36,7 +36,7 @@ Steps: - Checkout the tag you would like to generate docs for. - Run `php tests/__config/generate-api-docs.php` - The files *.md files in nikos/api/ will contain the documentation -- For publishing to the Phalcon website this [repo](https://github.com/phalcon/docs/tree/4.0/en/api) is used. +- For publishing to the Phalcon website this [repo](https://github.com/phalcon/docs/tree/5.0/en/api) is used. ## Links diff --git a/build/phalcon/phalcon.zep.c b/build/phalcon/phalcon.zep.c index 8d50b282430..d4ff9cd214f 100644 --- a/build/phalcon/phalcon.zep.c +++ b/build/phalcon/phalcon.zep.c @@ -28697,7 +28697,7 @@ static PHP_METHOD(Phalcon_Forms_Form, label) ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(name) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(attributes) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif @@ -28715,6 +28715,7 @@ static PHP_METHOD(Phalcon_Forms_Form, label) } if (!attributes_param) { ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { zephir_get_arrval(&attributes, attributes_param); } @@ -55151,78 +55152,71 @@ static PHP_METHOD(Phalcon_Db_Result_PdoResult, fetch) static PHP_METHOD(Phalcon_Db_Result_PdoResult, fetchAll) { - zend_bool _3; + zend_bool _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *fetchStyle_param = NULL, *fetchArgument_param = NULL, *ctorArgs_param = NULL, pdoStatement, mode, _0, _1$$3, _2$$3, _4$$4, _5$$4; - zend_long fetchStyle, fetchArgument, ctorArgs, ZEPHIR_LAST_CALL_STATUS; + zval *mode_param = NULL, *fetchArgument = NULL, fetchArgument_sub, *constructorArgs = NULL, constructorArgs_sub, __$null, _0$$3, _1$$3, _5, _6, _3$$4, _4$$4; + zend_long mode, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pdoStatement); - ZVAL_UNDEF(&mode); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&fetchArgument_sub); + ZVAL_UNDEF(&constructorArgs_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_3$$4); ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_LONG_OR_NULL(fetchStyle, is_null_true) - Z_PARAM_LONG(fetchArgument) - Z_PARAM_LONG(ctorArgs) + Z_PARAM_LONG(mode) + Z_PARAM_ZVAL(fetchArgument) + Z_PARAM_ZVAL_OR_NULL(constructorArgs) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &fetchStyle_param, &fetchArgument_param, &ctorArgs_param); - if (!fetchStyle_param) { - fetchStyle = 0; + zephir_fetch_params(1, 0, 3, &mode_param, &fetchArgument, &constructorArgs); + if (!mode_param) { + mode = 0; } else { - fetchStyle = zephir_get_intval(fetchStyle_param); + mode = zephir_get_intval(mode_param); } - if (!fetchArgument_param) { - fetchArgument = 0; - } else { - fetchArgument = zephir_get_intval(fetchArgument_param); + if (!fetchArgument) { + fetchArgument = &fetchArgument_sub; + ZEPHIR_INIT_VAR(fetchArgument); + ZVAL_LONG(fetchArgument, 0); } - if (!ctorArgs_param) { - ctorArgs = 0; - } else { - ctorArgs = zephir_get_intval(ctorArgs_param); + if (!constructorArgs) { + constructorArgs = &constructorArgs_sub; + constructorArgs = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdoStatement, &_0); - if (1 == 1) { - ZEPHIR_INIT_VAR(&mode); - ZVAL_LONG(&mode, fetchStyle); - } else { - ZEPHIR_OBS_NVAR(&mode); - zephir_read_property(&mode, this_ptr, ZEND_STRL("fetchMode"), PH_NOISY_CC); - } - if (fetchStyle == 8) { - ZVAL_LONG(&_1$$3, fetchArgument); - ZVAL_LONG(&_2$$3, ctorArgs); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &mode, &_1$$3, &_2$$3); + if (mode == 8) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1$$3, mode); + ZEPHIR_RETURN_CALL_METHOD(&_0$$3, "fetchall", NULL, 0, &_1$$3, fetchArgument, constructorArgs); zephir_check_call_status(); RETURN_MM(); } - _3 = fetchStyle == 7; - if (!(_3)) { - _3 = fetchStyle == 10; + _2 = mode == 7; + if (!(_2)) { + _2 = mode == 10; } - if (_3) { - ZVAL_LONG(&_4$$4, fetchStyle); - ZVAL_LONG(&_5$$4, fetchArgument); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &_4$$4, &_5$$4); + if (_2) { + zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_4$$4, mode); + ZEPHIR_RETURN_CALL_METHOD(&_3$$4, "fetchall", NULL, 0, &_4$$4, fetchArgument); zephir_check_call_status(); RETURN_MM(); } - ZVAL_LONG(&_0, fetchStyle); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &_0); + zephir_read_property(&_5, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_6, mode); + ZEPHIR_RETURN_CALL_METHOD(&_5, "fetchall", NULL, 0, &_6); zephir_check_call_status(); RETURN_MM(); } @@ -55317,7 +55311,7 @@ static PHP_METHOD(Phalcon_Db_Result_PdoResult, numRows) ZVAL_STRING(&_7$$6, "/^SELECT\\s+(.*)/i"); zephir_preg_match(&_6$$6, &_7$$6, &sqlStatement, &matches, 0, 0 , 0 ); if (zephir_is_true(&_6$$6)) { - zephir_array_fetch_long(&_8$$7, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Result/PdoResult.zep", 311); + zephir_array_fetch_long(&_8$$7, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Result/PdoResult.zep", 313); ZEPHIR_INIT_VAR(&_9$$7); ZEPHIR_CONCAT_SVS(&_9$$7, "SELECT COUNT(*) \"numrows\" FROM (SELECT ", &_8$$7, ")"); zephir_read_property(&_10$$7, this_ptr, ZEND_STRL("bindParams"), PH_NOISY_CC | PH_READONLY); @@ -55327,7 +55321,7 @@ static PHP_METHOD(Phalcon_Db_Result_PdoResult, numRows) ZEPHIR_CALL_METHOD(&row, &result, "fetch", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&rowCount); - zephir_array_fetch_string(&rowCount, &row, SL("numrows"), PH_NOISY, "phalcon/Db/Result/PdoResult.zep", 317); + zephir_array_fetch_string(&rowCount, &row, SL("numrows"), PH_NOISY, "phalcon/Db/Result/PdoResult.zep", 319); } } else { ZEPHIR_INIT_NVAR(&rowCount); @@ -81419,7 +81413,7 @@ static PHP_METHOD(Phalcon_Config_Config, setData) zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *element = NULL, element_sub, *value, value_sub, data, key, _0, _2$$3; + zval *element = NULL, element_sub, *value, value_sub, data, key, _0, _2$$3, _3$$3; zval *this_ptr = getThis(); ZVAL_UNDEF(&element_sub); @@ -81428,6 +81422,7 @@ static PHP_METHOD(Phalcon_Config_Config, setData) ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -81458,7 +81453,8 @@ static PHP_METHOD(Phalcon_Config_Config, setData) if (Z_TYPE_P(value) == IS_ARRAY) { ZEPHIR_INIT_VAR(&_2$$3); object_init_ex(&_2$$3, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 22, value); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 22, value, &_3$$3); zephir_check_call_status(); zephir_array_update_zval(&data, element, &_2$$3, PH_COPY | PH_SEPARATE); } else { @@ -81824,12 +81820,12 @@ ZEPHIR_INIT_CLASS(Phalcon_Config_Adapter_Grouped) static PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) { - zend_bool _4$$3, _20$$11; + zend_bool _4$$3, _21$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_16 = NULL, *_17 = NULL; - zval defaultAdapter, _15$$9, _28$$17; - zval *arrayConfig_param = NULL, *defaultAdapter_param = NULL, configArray, configInstance, configName, _1, *_2, _3, _12$$3, _13$$3, _6$$5, _11$$5, _7$$6, _9$$6, _14$$9, _18$$10, _19$$10, _25$$11, _26$$11, _21$$13, _24$$13, _22$$14, _23$$14, _27$$17, _29$$18, _30$$18; + zephir_fcall_cache_entry *_0 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_16 = NULL, *_18 = NULL; + zval defaultAdapter, _15$$9, _29$$17; + zval *arrayConfig_param = NULL, *defaultAdapter_param = NULL, configArray, configInstance, configName, _1, *_2, _3, _12$$3, _13$$3, _6$$5, _11$$5, _7$$6, _9$$6, _14$$9, _17$$8, _19$$10, _20$$10, _26$$11, _27$$11, _22$$13, _25$$13, _23$$14, _24$$14, _28$$17, _30$$16, _31$$18, _32$$18; zval arrayConfig; zval *this_ptr = getThis(); @@ -81846,20 +81842,22 @@ static PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) ZVAL_UNDEF(&_7$$6); ZVAL_UNDEF(&_9$$6); ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_18$$10); + ZVAL_UNDEF(&_17$$8); ZVAL_UNDEF(&_19$$10); - ZVAL_UNDEF(&_25$$11); + ZVAL_UNDEF(&_20$$10); ZVAL_UNDEF(&_26$$11); - ZVAL_UNDEF(&_21$$13); - ZVAL_UNDEF(&_24$$13); - ZVAL_UNDEF(&_22$$14); + ZVAL_UNDEF(&_27$$11); + ZVAL_UNDEF(&_22$$13); + ZVAL_UNDEF(&_25$$13); ZVAL_UNDEF(&_23$$14); - ZVAL_UNDEF(&_27$$17); - ZVAL_UNDEF(&_29$$18); - ZVAL_UNDEF(&_30$$18); + ZVAL_UNDEF(&_24$$14); + ZVAL_UNDEF(&_28$$17); + ZVAL_UNDEF(&_30$$16); + ZVAL_UNDEF(&_31$$18); + ZVAL_UNDEF(&_32$$18); ZVAL_UNDEF(&defaultAdapter); ZVAL_UNDEF(&_15$$9); - ZVAL_UNDEF(&_28$$17); + ZVAL_UNDEF(&_29$$17); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -81949,16 +81947,17 @@ static PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) zephir_array_fetch_string(&configArray, &configInstance, SL("config"), PH_NOISY, "phalcon/Config/Adapter/Grouped.zep", 113); ZEPHIR_INIT_NVAR(&configInstance); object_init_ex(&configInstance, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_17, 22, &configArray); + zephir_read_property(&_17$$8, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_18, 22, &configArray, &_17$$8); zephir_check_call_status(); } else { - ZEPHIR_INIT_NVAR(&_18$$10); - object_init_ex(&_18$$10, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_18$$10, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_19$$10); + object_init_ex(&_19$$10, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_19$$10, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_19$$10, &_18$$10, "load", &_10, 186, &configInstance); + ZEPHIR_CALL_METHOD(&_20$$10, &_19$$10, "load", &_10, 186, &configInstance); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&configInstance, &_19$$10); + ZEPHIR_CPY_WRT(&configInstance, &_20$$10); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); @@ -81975,48 +81974,48 @@ static PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) ZEPHIR_CALL_METHOD(&configName, &arrayConfig, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&configInstance, &configName); - _20$$11 = Z_TYPE_P(&configName) == IS_OBJECT; - if (_20$$11) { - _20$$11 = zephir_instance_of_ev(&configName, phalcon_config_configinterface_ce); + _21$$11 = Z_TYPE_P(&configName) == IS_OBJECT; + if (_21$$11) { + _21$$11 = zephir_instance_of_ev(&configName, phalcon_config_configinterface_ce); } - if (_20$$11) { + if (_21$$11) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); continue; } else if (Z_TYPE_P(&configName) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_21$$13); - ZVAL_STRING(&_21$$13, ""); - if (ZEPHIR_IS_IDENTICAL(&_21$$13, &defaultAdapter)) { - ZEPHIR_INIT_NVAR(&_22$$14); - object_init_ex(&_22$$14, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_22$$14, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_22$$13); + ZVAL_STRING(&_22$$13, ""); + if (ZEPHIR_IS_IDENTICAL(&_22$$13, &defaultAdapter)) { + ZEPHIR_INIT_NVAR(&_23$$14); + object_init_ex(&_23$$14, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_23$$14, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_23$$14, &_22$$14, "load", &_10, 186, &configName); + ZEPHIR_CALL_METHOD(&_24$$14, &_23$$14, "load", &_10, 186, &configName); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_23$$14); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_24$$14); zephir_check_call_status(); continue; } - ZEPHIR_INIT_NVAR(&_24$$13); - zephir_create_array(&_24$$13, 2, 0); - zephir_array_update_string(&_24$$13, SL("filePath"), &configName, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_24$$13, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(&configInstance, &_24$$13); + ZEPHIR_INIT_NVAR(&_25$$13); + zephir_create_array(&_25$$13, 2, 0); + zephir_array_update_string(&_25$$13, SL("filePath"), &configName, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_25$$13, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&configInstance, &_25$$13); } else if (!(zephir_array_isset_string(&configInstance, SL("adapter")))) { zephir_array_update_string(&configInstance, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); } - zephir_array_fetch_string(&_25$$11, &configInstance, SL("adapter"), PH_NOISY | PH_READONLY, "phalcon/Config/Adapter/Grouped.zep", 105); - ZEPHIR_INIT_NVAR(&_26$$11); - ZVAL_STRING(&_26$$11, "array"); - if (ZEPHIR_IS_IDENTICAL(&_26$$11, &_25$$11)) { + zephir_array_fetch_string(&_26$$11, &configInstance, SL("adapter"), PH_NOISY | PH_READONLY, "phalcon/Config/Adapter/Grouped.zep", 105); + ZEPHIR_INIT_NVAR(&_27$$11); + ZVAL_STRING(&_27$$11, "array"); + if (ZEPHIR_IS_IDENTICAL(&_27$$11, &_26$$11)) { if (!(zephir_array_isset_string(&configInstance, SL("config")))) { - ZEPHIR_INIT_NVAR(&_27$$17); - object_init_ex(&_27$$17, phalcon_config_exception_ce); ZEPHIR_INIT_NVAR(&_28$$17); - ZEPHIR_CONCAT_SS(&_28$$17, "To use 'array' adapter you have to specify ", "the 'config' as an array."); - ZEPHIR_CALL_METHOD(NULL, &_27$$17, "__construct", &_16, 29, &_28$$17); + object_init_ex(&_28$$17, phalcon_config_exception_ce); + ZEPHIR_INIT_NVAR(&_29$$17); + ZEPHIR_CONCAT_SS(&_29$$17, "To use 'array' adapter you have to specify ", "the 'config' as an array."); + ZEPHIR_CALL_METHOD(NULL, &_28$$17, "__construct", &_16, 29, &_29$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_27$$17, "phalcon/Config/Adapter/Grouped.zep", 110); + zephir_throw_exception_debug(&_28$$17, "phalcon/Config/Adapter/Grouped.zep", 110); ZEPHIR_MM_RESTORE(); return; } @@ -82024,16 +82023,17 @@ static PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) zephir_array_fetch_string(&configArray, &configInstance, SL("config"), PH_NOISY, "phalcon/Config/Adapter/Grouped.zep", 113); ZEPHIR_INIT_NVAR(&configInstance); object_init_ex(&configInstance, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_17, 22, &configArray); + zephir_read_property(&_30$$16, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_18, 22, &configArray, &_30$$16); zephir_check_call_status(); } else { - ZEPHIR_INIT_NVAR(&_29$$18); - object_init_ex(&_29$$18, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_29$$18, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_31$$18); + object_init_ex(&_31$$18, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_31$$18, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_30$$18, &_29$$18, "load", &_10, 186, &configInstance); + ZEPHIR_CALL_METHOD(&_32$$18, &_31$$18, "load", &_10, 186, &configInstance); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&configInstance, &_30$$18); + ZEPHIR_CPY_WRT(&configInstance, &_32$$18); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); @@ -212765,7 +212765,7 @@ static PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateExpiration) ZVAL_LONG(&_9, timestamp); ZEPHIR_CALL_METHOD(&_8, this_ptr, "gettimestamp", NULL, 264, &_9); zephir_check_call_status(); - _7 = ZEPHIR_LT_LONG(&_8, tokenExpirationTime); + _7 = ZEPHIR_GT_LONG(&_8, tokenExpirationTime); } if (_7) { ZEPHIR_INIT_ZVAL_NREF(_10$$3); @@ -217706,16 +217706,12 @@ static PHP_METHOD(Phalcon_Session_Manager, setName) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0, _1, _2, _3, _4; + zval *name_param = NULL, _0; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -217735,17 +217731,6 @@ static PHP_METHOD(Phalcon_Session_Manager, setName) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "Cannot set session name after a session has started", "phalcon/Session/Manager.zep", 294); return; } - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "/^[\\p{L}\\p{N}_-]+$/u"); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "/^[\\p{L}\\p{N}_-]+$/u"); - zephir_preg_match(&_3, &_4, &name, &_1, 0, 0 , 0 ); - if (UNEXPECTED(!zephir_is_true(&_3))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The name contains non alphanum characters", "phalcon/Session/Manager.zep", 300); - return; - } zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); ZEPHIR_CALL_FUNCTION(NULL, "session_name", NULL, 0, &name); zephir_check_call_status(); @@ -217826,7 +217811,7 @@ static PHP_METHOD(Phalcon_Session_Manager, start) ZEPHIR_OBS_VAR(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC); if (UNEXPECTED(!(zephir_is_instance_of(&_2, SL("SessionHandlerInterface"))))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The session adapter is not valid", "phalcon/Session/Manager.zep", 344); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The session adapter is not valid", "phalcon/Session/Manager.zep", 338); return; } ZEPHIR_OBS_VAR(&value); diff --git a/build/phalcon/phalcon.zep.h b/build/phalcon/phalcon.zep.h index ee7d968bd11..c02965100e0 100644 --- a/build/phalcon/phalcon.zep.h +++ b/build/phalcon/phalcon.zep.h @@ -17486,9 +17486,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetch, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetchall, 0, 0, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, fetchStyle, IS_LONG, 1) - ZEND_ARG_TYPE_INFO(0, fetchArgument, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, ctorArgs, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) + ZEND_ARG_INFO(0, fetchArgument) + ZEND_ARG_INFO(0, constructorArgs) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetcharray, 0, 0, 0) @@ -21029,9 +21029,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_forms_form_label, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) #if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attributes, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attributes, IS_ARRAY, 0, "[]") #else - ZEND_ARG_ARRAY_INFO(0, attributes, 1) + ZEND_ARG_ARRAY_INFO(0, attributes, 0) #endif ZEND_END_ARG_INFO() diff --git a/build/phalcon/php_phalcon.h b/build/phalcon/php_phalcon.h index 88308aef074..92d2657819c 100644 --- a/build/phalcon/php_phalcon.h +++ b/build/phalcon/php_phalcon.h @@ -103,7 +103,7 @@ typedef zend_function zephir_fcall_cache_entry; #define PHP_PHALCON_NAME "phalcon" -#define PHP_PHALCON_VERSION "5.0.4" +#define PHP_PHALCON_VERSION "5.0.5" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" #define PHP_PHALCON_ZEPVERSION "0.16.3-5099f34" diff --git a/config.json b/config.json index a5a86aa4361..c66d039558a 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "name": "phalcon", "description": "Phalcon is a full stack PHP framework, delivered as a PHP extension, offering lower resource consumption and high performance.", "author": "Phalcon Team and contributors", - "version": "5.0.4", + "version": "5.0.5", "verbose": false, "stubs": { "path": "ide\/%version%\/%namespace%\/", diff --git a/ext/phalcon/config/adapter/grouped.zep.c b/ext/phalcon/config/adapter/grouped.zep.c index 75b6e790ac0..eaaa44ca6a0 100644 --- a/ext/phalcon/config/adapter/grouped.zep.c +++ b/ext/phalcon/config/adapter/grouped.zep.c @@ -93,12 +93,12 @@ ZEPHIR_INIT_CLASS(Phalcon_Config_Adapter_Grouped) */ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) { - zend_bool _4$$3, _20$$11; + zend_bool _4$$3, _21$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_16 = NULL, *_17 = NULL; - zval defaultAdapter, _15$$9, _28$$17; - zval *arrayConfig_param = NULL, *defaultAdapter_param = NULL, configArray, configInstance, configName, _1, *_2, _3, _12$$3, _13$$3, _6$$5, _11$$5, _7$$6, _9$$6, _14$$9, _18$$10, _19$$10, _25$$11, _26$$11, _21$$13, _24$$13, _22$$14, _23$$14, _27$$17, _29$$18, _30$$18; + zephir_fcall_cache_entry *_0 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_16 = NULL, *_18 = NULL; + zval defaultAdapter, _15$$9, _29$$17; + zval *arrayConfig_param = NULL, *defaultAdapter_param = NULL, configArray, configInstance, configName, _1, *_2, _3, _12$$3, _13$$3, _6$$5, _11$$5, _7$$6, _9$$6, _14$$9, _17$$8, _19$$10, _20$$10, _26$$11, _27$$11, _22$$13, _25$$13, _23$$14, _24$$14, _28$$17, _30$$16, _31$$18, _32$$18; zval arrayConfig; zval *this_ptr = getThis(); @@ -115,20 +115,22 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) ZVAL_UNDEF(&_7$$6); ZVAL_UNDEF(&_9$$6); ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_18$$10); + ZVAL_UNDEF(&_17$$8); ZVAL_UNDEF(&_19$$10); - ZVAL_UNDEF(&_25$$11); + ZVAL_UNDEF(&_20$$10); ZVAL_UNDEF(&_26$$11); - ZVAL_UNDEF(&_21$$13); - ZVAL_UNDEF(&_24$$13); - ZVAL_UNDEF(&_22$$14); + ZVAL_UNDEF(&_27$$11); + ZVAL_UNDEF(&_22$$13); + ZVAL_UNDEF(&_25$$13); ZVAL_UNDEF(&_23$$14); - ZVAL_UNDEF(&_27$$17); - ZVAL_UNDEF(&_29$$18); - ZVAL_UNDEF(&_30$$18); + ZVAL_UNDEF(&_24$$14); + ZVAL_UNDEF(&_28$$17); + ZVAL_UNDEF(&_30$$16); + ZVAL_UNDEF(&_31$$18); + ZVAL_UNDEF(&_32$$18); ZVAL_UNDEF(&defaultAdapter); ZVAL_UNDEF(&_15$$9); - ZVAL_UNDEF(&_28$$17); + ZVAL_UNDEF(&_29$$17); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -218,16 +220,17 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) zephir_array_fetch_string(&configArray, &configInstance, SL("config"), PH_NOISY, "phalcon/Config/Adapter/Grouped.zep", 113); ZEPHIR_INIT_NVAR(&configInstance); object_init_ex(&configInstance, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_17, 22, &configArray); + zephir_read_property(&_17$$8, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_18, 22, &configArray, &_17$$8); zephir_check_call_status(); } else { - ZEPHIR_INIT_NVAR(&_18$$10); - object_init_ex(&_18$$10, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_18$$10, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_19$$10); + object_init_ex(&_19$$10, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_19$$10, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_19$$10, &_18$$10, "load", &_10, 186, &configInstance); + ZEPHIR_CALL_METHOD(&_20$$10, &_19$$10, "load", &_10, 186, &configInstance); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&configInstance, &_19$$10); + ZEPHIR_CPY_WRT(&configInstance, &_20$$10); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); @@ -244,48 +247,48 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) ZEPHIR_CALL_METHOD(&configName, &arrayConfig, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&configInstance, &configName); - _20$$11 = Z_TYPE_P(&configName) == IS_OBJECT; - if (_20$$11) { - _20$$11 = zephir_instance_of_ev(&configName, phalcon_config_configinterface_ce); + _21$$11 = Z_TYPE_P(&configName) == IS_OBJECT; + if (_21$$11) { + _21$$11 = zephir_instance_of_ev(&configName, phalcon_config_configinterface_ce); } - if (_20$$11) { + if (_21$$11) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); continue; } else if (Z_TYPE_P(&configName) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_21$$13); - ZVAL_STRING(&_21$$13, ""); - if (ZEPHIR_IS_IDENTICAL(&_21$$13, &defaultAdapter)) { - ZEPHIR_INIT_NVAR(&_22$$14); - object_init_ex(&_22$$14, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_22$$14, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_22$$13); + ZVAL_STRING(&_22$$13, ""); + if (ZEPHIR_IS_IDENTICAL(&_22$$13, &defaultAdapter)) { + ZEPHIR_INIT_NVAR(&_23$$14); + object_init_ex(&_23$$14, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_23$$14, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_23$$14, &_22$$14, "load", &_10, 186, &configName); + ZEPHIR_CALL_METHOD(&_24$$14, &_23$$14, "load", &_10, 186, &configName); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_23$$14); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_24$$14); zephir_check_call_status(); continue; } - ZEPHIR_INIT_NVAR(&_24$$13); - zephir_create_array(&_24$$13, 2, 0); - zephir_array_update_string(&_24$$13, SL("filePath"), &configName, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_24$$13, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(&configInstance, &_24$$13); + ZEPHIR_INIT_NVAR(&_25$$13); + zephir_create_array(&_25$$13, 2, 0); + zephir_array_update_string(&_25$$13, SL("filePath"), &configName, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_25$$13, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&configInstance, &_25$$13); } else if (!(zephir_array_isset_string(&configInstance, SL("adapter")))) { zephir_array_update_string(&configInstance, SL("adapter"), &defaultAdapter, PH_COPY | PH_SEPARATE); } - zephir_array_fetch_string(&_25$$11, &configInstance, SL("adapter"), PH_NOISY | PH_READONLY, "phalcon/Config/Adapter/Grouped.zep", 105); - ZEPHIR_INIT_NVAR(&_26$$11); - ZVAL_STRING(&_26$$11, "array"); - if (ZEPHIR_IS_IDENTICAL(&_26$$11, &_25$$11)) { + zephir_array_fetch_string(&_26$$11, &configInstance, SL("adapter"), PH_NOISY | PH_READONLY, "phalcon/Config/Adapter/Grouped.zep", 105); + ZEPHIR_INIT_NVAR(&_27$$11); + ZVAL_STRING(&_27$$11, "array"); + if (ZEPHIR_IS_IDENTICAL(&_27$$11, &_26$$11)) { if (!(zephir_array_isset_string(&configInstance, SL("config")))) { - ZEPHIR_INIT_NVAR(&_27$$17); - object_init_ex(&_27$$17, phalcon_config_exception_ce); ZEPHIR_INIT_NVAR(&_28$$17); - ZEPHIR_CONCAT_SS(&_28$$17, "To use 'array' adapter you have to specify ", "the 'config' as an array."); - ZEPHIR_CALL_METHOD(NULL, &_27$$17, "__construct", &_16, 29, &_28$$17); + object_init_ex(&_28$$17, phalcon_config_exception_ce); + ZEPHIR_INIT_NVAR(&_29$$17); + ZEPHIR_CONCAT_SS(&_29$$17, "To use 'array' adapter you have to specify ", "the 'config' as an array."); + ZEPHIR_CALL_METHOD(NULL, &_28$$17, "__construct", &_16, 29, &_29$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_27$$17, "phalcon/Config/Adapter/Grouped.zep", 110); + zephir_throw_exception_debug(&_28$$17, "phalcon/Config/Adapter/Grouped.zep", 110); ZEPHIR_MM_RESTORE(); return; } @@ -293,16 +296,17 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) zephir_array_fetch_string(&configArray, &configInstance, SL("config"), PH_NOISY, "phalcon/Config/Adapter/Grouped.zep", 113); ZEPHIR_INIT_NVAR(&configInstance); object_init_ex(&configInstance, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_17, 22, &configArray); + zephir_read_property(&_30$$16, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &configInstance, "__construct", &_18, 22, &configArray, &_30$$16); zephir_check_call_status(); } else { - ZEPHIR_INIT_NVAR(&_29$$18); - object_init_ex(&_29$$18, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_29$$18, "__construct", &_8, 185); + ZEPHIR_INIT_NVAR(&_31$$18); + object_init_ex(&_31$$18, phalcon_config_configfactory_ce); + ZEPHIR_CALL_METHOD(NULL, &_31$$18, "__construct", &_8, 185); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_30$$18, &_29$$18, "load", &_10, 186, &configInstance); + ZEPHIR_CALL_METHOD(&_32$$18, &_31$$18, "load", &_10, 186, &configInstance); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&configInstance, &_30$$18); + ZEPHIR_CPY_WRT(&configInstance, &_32$$18); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &configInstance); zephir_check_call_status(); diff --git a/ext/phalcon/config/config.zep.c b/ext/phalcon/config/config.zep.c index 42287f1771c..4c5b88937f9 100644 --- a/ext/phalcon/config/config.zep.c +++ b/ext/phalcon/config/config.zep.c @@ -520,7 +520,7 @@ PHP_METHOD(Phalcon_Config_Config, setData) zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *element = NULL, element_sub, *value, value_sub, data, key, _0, _2$$3; + zval *element = NULL, element_sub, *value, value_sub, data, key, _0, _2$$3, _3$$3; zval *this_ptr = getThis(); ZVAL_UNDEF(&element_sub); @@ -529,6 +529,7 @@ PHP_METHOD(Phalcon_Config_Config, setData) ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -559,7 +560,8 @@ PHP_METHOD(Phalcon_Config_Config, setData) if (Z_TYPE_P(value) == IS_ARRAY) { ZEPHIR_INIT_VAR(&_2$$3); object_init_ex(&_2$$3, phalcon_config_config_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 22, value); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("insensitive"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 22, value, &_3$$3); zephir_check_call_status(); zephir_array_update_zval(&data, element, &_2$$3, PH_COPY | PH_SEPARATE); } else { diff --git a/ext/phalcon/db/result/pdoresult.zep.c b/ext/phalcon/db/result/pdoresult.zep.c index 97f736a2d8b..58a66e28421 100644 --- a/ext/phalcon/db/result/pdoresult.zep.c +++ b/ext/phalcon/db/result/pdoresult.zep.c @@ -339,81 +339,78 @@ PHP_METHOD(Phalcon_Db_Result_PdoResult, fetch) * * $robots = $result->fetchAll(); *``` + * + * @param int $mode + * @param int|string|callable|null $fetchArgument + * @param array|null $constructorArgs */ PHP_METHOD(Phalcon_Db_Result_PdoResult, fetchAll) { - zend_bool _3; + zend_bool _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *fetchStyle_param = NULL, *fetchArgument_param = NULL, *ctorArgs_param = NULL, pdoStatement, mode, _0, _1$$3, _2$$3, _4$$4, _5$$4; - zend_long fetchStyle, fetchArgument, ctorArgs, ZEPHIR_LAST_CALL_STATUS; + zval *mode_param = NULL, *fetchArgument = NULL, fetchArgument_sub, *constructorArgs = NULL, constructorArgs_sub, __$null, _0$$3, _1$$3, _5, _6, _3$$4, _4$$4; + zend_long mode, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pdoStatement); - ZVAL_UNDEF(&mode); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&fetchArgument_sub); + ZVAL_UNDEF(&constructorArgs_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_3$$4); ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_LONG_OR_NULL(fetchStyle, is_null_true) - Z_PARAM_LONG(fetchArgument) - Z_PARAM_LONG(ctorArgs) + Z_PARAM_LONG(mode) + Z_PARAM_ZVAL(fetchArgument) + Z_PARAM_ZVAL_OR_NULL(constructorArgs) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &fetchStyle_param, &fetchArgument_param, &ctorArgs_param); - if (!fetchStyle_param) { - fetchStyle = 0; + zephir_fetch_params(1, 0, 3, &mode_param, &fetchArgument, &constructorArgs); + if (!mode_param) { + mode = 0; } else { - fetchStyle = zephir_get_intval(fetchStyle_param); + mode = zephir_get_intval(mode_param); } - if (!fetchArgument_param) { - fetchArgument = 0; - } else { - fetchArgument = zephir_get_intval(fetchArgument_param); + if (!fetchArgument) { + fetchArgument = &fetchArgument_sub; + ZEPHIR_INIT_VAR(fetchArgument); + ZVAL_LONG(fetchArgument, 0); } - if (!ctorArgs_param) { - ctorArgs = 0; - } else { - ctorArgs = zephir_get_intval(ctorArgs_param); + if (!constructorArgs) { + constructorArgs = &constructorArgs_sub; + constructorArgs = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdoStatement, &_0); - if (1 == 1) { - ZEPHIR_INIT_VAR(&mode); - ZVAL_LONG(&mode, fetchStyle); - } else { - ZEPHIR_OBS_NVAR(&mode); - zephir_read_property(&mode, this_ptr, ZEND_STRL("fetchMode"), PH_NOISY_CC); - } - if (fetchStyle == 8) { - ZVAL_LONG(&_1$$3, fetchArgument); - ZVAL_LONG(&_2$$3, ctorArgs); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &mode, &_1$$3, &_2$$3); + if (mode == 8) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1$$3, mode); + ZEPHIR_RETURN_CALL_METHOD(&_0$$3, "fetchall", NULL, 0, &_1$$3, fetchArgument, constructorArgs); zephir_check_call_status(); RETURN_MM(); } - _3 = fetchStyle == 7; - if (!(_3)) { - _3 = fetchStyle == 10; + _2 = mode == 7; + if (!(_2)) { + _2 = mode == 10; } - if (_3) { - ZVAL_LONG(&_4$$4, fetchStyle); - ZVAL_LONG(&_5$$4, fetchArgument); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &_4$$4, &_5$$4); + if (_2) { + zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_4$$4, mode); + ZEPHIR_RETURN_CALL_METHOD(&_3$$4, "fetchall", NULL, 0, &_4$$4, fetchArgument); zephir_check_call_status(); RETURN_MM(); } - ZVAL_LONG(&_0, fetchStyle); - ZEPHIR_RETURN_CALL_METHOD(&pdoStatement, "fetchall", NULL, 0, &_0); + zephir_read_property(&_5, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_6, mode); + ZEPHIR_RETURN_CALL_METHOD(&_5, "fetchall", NULL, 0, &_6); zephir_check_call_status(); RETURN_MM(); } @@ -539,7 +536,7 @@ PHP_METHOD(Phalcon_Db_Result_PdoResult, numRows) ZVAL_STRING(&_7$$6, "/^SELECT\\s+(.*)/i"); zephir_preg_match(&_6$$6, &_7$$6, &sqlStatement, &matches, 0, 0 , 0 ); if (zephir_is_true(&_6$$6)) { - zephir_array_fetch_long(&_8$$7, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Result/PdoResult.zep", 311); + zephir_array_fetch_long(&_8$$7, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Result/PdoResult.zep", 313); ZEPHIR_INIT_VAR(&_9$$7); ZEPHIR_CONCAT_SVS(&_9$$7, "SELECT COUNT(*) \"numrows\" FROM (SELECT ", &_8$$7, ")"); zephir_read_property(&_10$$7, this_ptr, ZEND_STRL("bindParams"), PH_NOISY_CC | PH_READONLY); @@ -549,7 +546,7 @@ PHP_METHOD(Phalcon_Db_Result_PdoResult, numRows) ZEPHIR_CALL_METHOD(&row, &result, "fetch", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&rowCount); - zephir_array_fetch_string(&rowCount, &row, SL("numrows"), PH_NOISY, "phalcon/Db/Result/PdoResult.zep", 317); + zephir_array_fetch_string(&rowCount, &row, SL("numrows"), PH_NOISY, "phalcon/Db/Result/PdoResult.zep", 319); } } else { ZEPHIR_INIT_NVAR(&rowCount); diff --git a/ext/phalcon/db/result/pdoresult.zep.h b/ext/phalcon/db/result/pdoresult.zep.h index 56eb8da1bbe..cc8a1ddcd84 100644 --- a/ext/phalcon/db/result/pdoresult.zep.h +++ b/ext/phalcon/db/result/pdoresult.zep.h @@ -37,9 +37,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetch, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetchall, 0, 0, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, fetchStyle, IS_LONG, 1) - ZEND_ARG_TYPE_INFO(0, fetchArgument, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, ctorArgs, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) + ZEND_ARG_INFO(0, fetchArgument) + ZEND_ARG_INFO(0, constructorArgs) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_result_pdoresult_fetcharray, 0, 0, 0) diff --git a/ext/phalcon/encryption/security/jwt/validator.zep.c b/ext/phalcon/encryption/security/jwt/validator.zep.c index aeec2188286..cee174e5504 100644 --- a/ext/phalcon/encryption/security/jwt/validator.zep.c +++ b/ext/phalcon/encryption/security/jwt/validator.zep.c @@ -369,7 +369,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateExpiration) ZVAL_LONG(&_9, timestamp); ZEPHIR_CALL_METHOD(&_8, this_ptr, "gettimestamp", NULL, 264, &_9); zephir_check_call_status(); - _7 = ZEPHIR_LT_LONG(&_8, tokenExpirationTime); + _7 = ZEPHIR_GT_LONG(&_8, tokenExpirationTime); } if (_7) { ZEPHIR_INIT_ZVAL_NREF(_10$$3); diff --git a/ext/phalcon/forms/form.zep.c b/ext/phalcon/forms/form.zep.c index 01368396a1d..c7c3b1f76c6 100644 --- a/ext/phalcon/forms/form.zep.c +++ b/ext/phalcon/forms/form.zep.c @@ -1585,7 +1585,7 @@ PHP_METHOD(Phalcon_Forms_Form, label) ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(name) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(attributes) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1603,6 +1603,7 @@ PHP_METHOD(Phalcon_Forms_Form, label) } if (!attributes_param) { ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { zephir_get_arrval(&attributes, attributes_param); } diff --git a/ext/phalcon/forms/form.zep.h b/ext/phalcon/forms/form.zep.h index b7fc1e55206..b25bec81159 100644 --- a/ext/phalcon/forms/form.zep.h +++ b/ext/phalcon/forms/form.zep.h @@ -159,9 +159,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_forms_form_label, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) #if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attributes, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attributes, IS_ARRAY, 0, "[]") #else - ZEND_ARG_ARRAY_INFO(0, attributes, 1) + ZEND_ARG_ARRAY_INFO(0, attributes, 0) #endif ZEND_END_ARG_INFO() diff --git a/ext/phalcon/session/manager.zep.c b/ext/phalcon/session/manager.zep.c index 1f4d6a76ff3..73c56cf8f88 100644 --- a/ext/phalcon/session/manager.zep.c +++ b/ext/phalcon/session/manager.zep.c @@ -671,16 +671,12 @@ PHP_METHOD(Phalcon_Session_Manager, setName) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0, _1, _2, _3, _4; + zval *name_param = NULL, _0; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -700,17 +696,6 @@ PHP_METHOD(Phalcon_Session_Manager, setName) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "Cannot set session name after a session has started", "phalcon/Session/Manager.zep", 294); return; } - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "/^[\\p{L}\\p{N}_-]+$/u"); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "/^[\\p{L}\\p{N}_-]+$/u"); - zephir_preg_match(&_3, &_4, &name, &_1, 0, 0 , 0 ); - if (UNEXPECTED(!zephir_is_true(&_3))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The name contains non alphanum characters", "phalcon/Session/Manager.zep", 300); - return; - } zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); ZEPHIR_CALL_FUNCTION(NULL, "session_name", NULL, 0, &name); zephir_check_call_status(); @@ -798,7 +783,7 @@ PHP_METHOD(Phalcon_Session_Manager, start) ZEPHIR_OBS_VAR(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC); if (UNEXPECTED(!(zephir_is_instance_of(&_2, SL("SessionHandlerInterface"))))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The session adapter is not valid", "phalcon/Session/Manager.zep", 344); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_session_exception_ce, "The session adapter is not valid", "phalcon/Session/Manager.zep", 338); return; } ZEPHIR_OBS_VAR(&value); diff --git a/ext/php_phalcon.h b/ext/php_phalcon.h index d06fa7f878c..f0de1ad7bbe 100644 --- a/ext/php_phalcon.h +++ b/ext/php_phalcon.h @@ -11,7 +11,7 @@ #include "kernel/globals.h" #define PHP_PHALCON_NAME "phalcon" -#define PHP_PHALCON_VERSION "5.0.4" +#define PHP_PHALCON_VERSION "5.0.5" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" #define PHP_PHALCON_ZEPVERSION "0.16.3-5099f34" diff --git a/package.xml b/package.xml index 653e719e469..334e6fa7d77 100644 --- a/package.xml +++ b/package.xml @@ -22,11 +22,11 @@ nikos@phalcon.io yes - 2022-10-17 + 2022-10-24 - 5.0.4 - 5.0.4 + 5.0.5 + 5.0.5 stable @@ -37,12 +37,11 @@ Full changelog can be found at: https://github.com/phalcon/cphalcon/blob/master/CHANGELOG-5.0.md ## Fixed - - Fixed `Phalcon\Encryption\Security` to take into account the `workFactor` in the cost calculation [#16153](https://github.com/phalcon/cphalcon/issues/16153) - - Removed double unserializing during Model caching [#16035](https://github.com/phalcon/cphalcon/issues/16035), [#16131](https://github.com/phalcon/cphalcon/issues/16131) - - Fixed `Phalcon\Db\Adapter\Pdo\Mysql::describeIndexes` to assign an empty string in the index type of `null` and remove warnings [#16157](https://github.com/phalcon/cphalcon/issues/16157) - - Fixed `Phalcon\Db\Adapter\Pdo\Sqlite::describeIndexes` to assign an empty string in the index type of `null` and remove warnings [#16157](https://github.com/phalcon/cphalcon/issues/16157) - - Fixed `Phalcon\Mvc\Model\Manager::notifyEvent` to return `true` instead of `null` on success [#16161](https://github.com/phalcon/cphalcon/issues/16161) - - Fixed `Phalcon\Encryption\Security\JWT\Validator::validateExpiration` to correctly validate the `exp` claim [#16166](https://github.com/phalcon/cphalcon/issues/16166) + - Fixed `Phalcon\Config\Config::setData` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171) + - Fixed `Phalcon\Config\Adapter\Groupped::__construct` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171) + - Fixed `Phalcon\Session\Manager::setName`, removing the regex check for the name for custom adapters to work with `create_sid()` [#16170](https://github.com/phalcon/cphalcon/issues/16170) + - Fixed `PdoResult::fetchAll` when passed class name in 2nd argument [#16177](https://github.com/phalcon/cphalcon/issues/16177) + - Fixed `Forms\Form::label` to accept an array as a default variable [#16180](https://github.com/phalcon/cphalcon/issues/16180) diff --git a/phalcon/Config/Adapter/Grouped.zep b/phalcon/Config/Adapter/Grouped.zep index 71cbbeb6432..5d0c93fe0e6 100644 --- a/phalcon/Config/Adapter/Grouped.zep +++ b/phalcon/Config/Adapter/Grouped.zep @@ -111,7 +111,7 @@ class Grouped extends Config } let configArray = configInstance["config"], - configInstance = new Config(configArray); + configInstance = new Config(configArray, this->insensitive); } else { let configInstance = (new ConfigFactory())->load(configInstance); } diff --git a/phalcon/Config/Config.zep b/phalcon/Config/Config.zep index 26e0af38058..10747f41f94 100644 --- a/phalcon/Config/Config.zep +++ b/phalcon/Config/Config.zep @@ -250,7 +250,7 @@ class Config extends Collection implements ConfigInterface let this->lowerKeys[key] = element; if typeof value === "array" { - let data[element] = new Config(value); + let data[element] = new Config(value, this->insensitive); } else { let data[element] = value; } diff --git a/phalcon/Db/Result/PdoResult.zep b/phalcon/Db/Result/PdoResult.zep index 8fb46b077af..45c86e1d023 100644 --- a/phalcon/Db/Result/PdoResult.zep +++ b/phalcon/Db/Result/PdoResult.zep @@ -210,23 +210,25 @@ class PdoResult implements ResultInterface * * $robots = $result->fetchAll(); *``` + * + * @param int $mode + * @param int|string|callable|null $fetchArgument + * @param array|null $constructorArgs */ - public function fetchAll(int fetchStyle = null, int fetchArgument = Pdo::FETCH_ORI_NEXT, int ctorArgs = 0) -> array - { - var pdoStatement, mode; - - let pdoStatement = this->pdoStatement; - let mode = typeof fetchStyle === "int" ? fetchStyle : this->fetchMode; - - if fetchStyle == Enum::FETCH_CLASS { - return pdoStatement->fetchAll(mode, fetchArgument, ctorArgs); + public function fetchAll( + int mode = Enum::FETCH_DEFAULT, + var fetchArgument = Pdo::FETCH_ORI_NEXT, + var constructorArgs = null + ) -> array { + if mode == Enum::FETCH_CLASS { + return this->pdoStatement->fetchAll(mode, fetchArgument, constructorArgs); } - if fetchStyle == Enum::FETCH_COLUMN || fetchStyle == Enum::FETCH_FUNC { - return pdoStatement->fetchAll(fetchStyle, fetchArgument); + if mode == Enum::FETCH_COLUMN || mode == Enum::FETCH_FUNC { + return this->pdoStatement->fetchAll(mode, fetchArgument); } - return pdoStatement->fetchAll(fetchStyle); + return this->pdoStatement->fetchAll(mode); } /** diff --git a/phalcon/Forms/Form.zep b/phalcon/Forms/Form.zep index 96f107261c9..30f186d4a8f 100644 --- a/phalcon/Forms/Form.zep +++ b/phalcon/Forms/Form.zep @@ -754,7 +754,7 @@ class Form extends Injectable implements Countable, Iterator, AttributesInterfac /** * Generate the label of an element added to the form including HTML */ - public function label(string! name, array attributes = null) -> string + public function label(string! name, array attributes = []) -> string { var element; diff --git a/phalcon/Session/Manager.zep b/phalcon/Session/Manager.zep index f65264b5855..c67dd06c92b 100644 --- a/phalcon/Session/Manager.zep +++ b/phalcon/Session/Manager.zep @@ -294,12 +294,6 @@ class Manager extends AbstractInjectionAware implements ManagerInterface ); } - if unlikely !preg_match("/^[\p{L}\p{N}_-]+$/u", name) { - throw new Exception( - "The name contains non alphanum characters" - ); - } - let this->name = name; session_name(name); diff --git a/phalcon/Support/Version.zep b/phalcon/Support/Version.zep index c38170605f8..304e7a851a9 100644 --- a/phalcon/Support/Version.zep +++ b/phalcon/Support/Version.zep @@ -77,7 +77,7 @@ class Version */ protected function getVersion() -> array { - return [5, 0, 4, 4, 0]; + return [5, 0, 5, 4, 0]; } /** diff --git a/tests/integration/Session/Manager/GetSetNameCest.php b/tests/integration/Session/Manager/GetSetNameCest.php index a4ee4df9705..b6a45ca586f 100644 --- a/tests/integration/Session/Manager/GetSetNameCest.php +++ b/tests/integration/Session/Manager/GetSetNameCest.php @@ -50,29 +50,6 @@ public function sessionManagerGetSetName(IntegrationTester $I) $I->assertEquals($expected, $actual); } - /** - * Tests Phalcon\Session\Manager :: getName()/setName() - not valid name - * - * @param IntegrationTester $I - * - * @author Phalcon Team - * @since 2020-09-09 - */ - public function sessionManagerGetNameNotValidName(IntegrationTester $I) - { - $I->wantToTest('Session\Manager - getName()/setName() - not valid name'); - $I->expectThrowable( - new Exception('The name contains non alphanum characters'), - function () { - $manager = new Manager(); - $files = $this->newService('sessionStream'); - $manager->setAdapter($files); - - $manager->setName('%-gga34'); - } - ); - } - /** * Tests Phalcon\Session\Manager :: getName()/setName() - session started * diff --git a/tests/integration/Session/Manager/StartCest.php b/tests/integration/Session/Manager/StartCest.php index 9522eb5690a..f9895e352ca 100644 --- a/tests/integration/Session/Manager/StartCest.php +++ b/tests/integration/Session/Manager/StartCest.php @@ -19,8 +19,6 @@ use Phalcon\Tests\Fixtures\Traits\DiTrait; /** - * Class StartCest - * * @package Phalcon\Tests\Integration\Session\Manager */ class StartCest diff --git a/tests/unit/Config/Config/ConfigCest.php b/tests/unit/Config/Config/ConfigCest.php index f46cc8fcfff..5698184e92a 100644 --- a/tests/unit/Config/Config/ConfigCest.php +++ b/tests/unit/Config/Config/ConfigCest.php @@ -83,4 +83,42 @@ public function testStandardConfigSimpleArray(UnitTester $I) $actual = new Config($settings); $I->assertEquals($expected, $actual); } + + /** + * Test insensitive in sub arrays + * + * @param UnitTester $I + * + * @return void + * + * @issue 16171 + * @author Phalcon Team + * @since 2022-10-19 + */ + public function configConfigConfigInsensitive(UnitTester $I) + { + $settings = [ + 'database' => [ + 'adapter' => 'Mysql', + 'host' => 'localhost', + 'username' => 'scott', + 'password' => 'cheetah', + 'name' => 'test_db', + ], + 'other' => [1, 2, 3, 4], + ]; + $config = new Config($settings, false); + + /** @var Config $database */ + $database = $config->get('database'); + + $class = Config::class; + $I->assertInstanceOf($class, $database); + + $actual = $database->has('adapter'); + $I->assertTrue($actual); + + $actual = $database->has('ADAPTER'); + $I->assertFalse($actual); + } }