/** * Reconfigure the route adding a new pattern and a set of paths * * @param string pattern * @param array paths */ PHP_METHOD(Test_Router_Route, reConfigure) { int ZEPHIR_LAST_CALL_STATUS, _0$$5; zval *pattern, *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_1$$10, *_2$$19, *_3$$19; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(pattern) != IS_STRING) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "The pattern must be string", "test/router/route.zep", 270); return; } if (Z_TYPE_P(paths) != IS_NULL) { if (Z_TYPE_P(paths) == IS_STRING) { ZEPHIR_INIT_VAR(moduleName); ZVAL_NULL(moduleName); ZEPHIR_INIT_VAR(controllerName); ZVAL_NULL(controllerName); ZEPHIR_INIT_VAR(actionName); ZVAL_NULL(actionName); ZEPHIR_INIT_VAR(parts); zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); do { _0$$5 = zephir_fast_count_int(parts TSRMLS_CC); if (_0$$5 == 3) { ZEPHIR_OBS_NVAR(moduleName); zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "test/router/route.zep", 286 TSRMLS_CC); ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "test/router/route.zep", 287 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "test/router/route.zep", 288 TSRMLS_CC); break; } if (_0$$5 == 2) { ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "test/router/route.zep", 291 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "test/router/route.zep", 292 TSRMLS_CC); break; } if (_0$$5 == 1) { ZEPHIR_OBS_NVAR(controllerName); zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "test/router/route.zep", 295 TSRMLS_CC); break; } } while(0); ZEPHIR_INIT_VAR(routePaths); array_init(routePaths); if (Z_TYPE_P(moduleName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(controllerName) != IS_NULL) { if (zephir_memnstr_str(controllerName, SL("\\"), "test/router/route.zep", 310)) { ZEPHIR_INIT_VAR(realClassName); zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(namespaceName); zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC); if (zephir_is_true(namespaceName)) { zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(realClassName, controllerName); } ZEPHIR_INIT_VAR(_1$$10); zephir_uncamelize(_1$$10, realClassName, NULL ); zephir_array_update_string(&routePaths, SL("controller"), &_1$$10, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(actionName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(routePaths, paths); } } else { ZEPHIR_INIT_NVAR(routePaths); array_init(routePaths); } if (Z_TYPE_P(routePaths) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "The route contains invalid paths", "test/router/route.zep", 342); return; } if (!(zephir_start_with_str(pattern, SL("#")))) { if (zephir_memnstr_str(pattern, SL("{"), "test/router/route.zep", 348)) { ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); zephir_check_call_status(); ZEPHIR_OBS_VAR(pcrePattern); zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "test/router/route.zep", 351 TSRMLS_CC); ZEPHIR_INIT_VAR(_2$$19); zephir_array_fetch_long(&_3$$19, extracted, 1, PH_NOISY | PH_READONLY, "test/router/route.zep", 352 TSRMLS_CC); zephir_fast_array_merge(_2$$19, &(routePaths), &(_3$$19) TSRMLS_CC); ZEPHIR_CPY_WRT(routePaths, _2$$19); } else { ZEPHIR_CPY_WRT(pcrePattern, pattern); } ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(compiledPattern, pattern); } zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Applies a format to a message before sending it to the log * * @param string $message * @param int $type * @param int $timestamp * @param array $context * * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Firephp, format) { HashTable *_11$$4; HashPosition _10$$4; zval *_22; zend_bool _15, _18, param$$4 = 0; int type, timestamp, ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *meta = NULL, *body = NULL, *backtrace = NULL, *encoded = NULL, *len = NULL, *lastTrace = NULL, *_1 = NULL, *_2, *_3, *_13, *_14, *_16, *_17, *_19, *_0$$3 = NULL, *backtraceItem$$4 = NULL, *key$$4 = NULL, *_4$$4, _5$$4 = zval_used_for_init, _6$$4, *_7$$4 = NULL, **_12$$4, *_8$$6, *_9$$7, *_20$$12, *_21$$12; zval *message = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &message_param, &type_param, ×tamp_param, &context); zephir_get_strval(message, message_param); type = zephir_get_intval(type_param); timestamp = zephir_get_intval(timestamp_param); if (!context) { context = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(context) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "interpolate", NULL, 0, message, context); zephir_check_call_status(); zephir_get_strval(message, _0$$3); } ZEPHIR_INIT_VAR(meta); zephir_create_array(meta, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, type); ZEPHIR_CALL_METHOD(&_1, this_ptr, "gettypestring", NULL, 0, _2); zephir_check_call_status(); zephir_array_update_string(&meta, SL("Type"), &_1, PH_COPY | PH_SEPARATE); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_3)) { param$$4 = 0; ZEPHIR_INIT_VAR(_4$$4); ZEPHIR_GET_CONSTANT(_4$$4, "PHP_VERSION"); ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "5.3.6", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "<", 0); ZEPHIR_CALL_FUNCTION(&_7$$4, "version_compare", NULL, 241, _4$$4, &_5$$4, &_6$$4); zephir_check_call_status(); if (!(zephir_is_true(_7$$4))) { param$$4 = (2) ? 1 : 0; } ZEPHIR_SINIT_NVAR(_5$$4); ZVAL_BOOL(&_5$$4, (param$$4 ? 1 : 0)); ZEPHIR_CALL_FUNCTION(&backtrace, "debug_backtrace", NULL, 153, &_5$$4); zephir_check_call_status(); ZEPHIR_MAKE_REF(backtrace); ZEPHIR_CALL_FUNCTION(&lastTrace, "end", NULL, 172, backtrace); ZEPHIR_UNREF(backtrace); zephir_check_call_status(); if (zephir_array_isset_string(lastTrace, SS("file"))) { zephir_array_fetch_string(&_8$$6, lastTrace, SL("file"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 133 TSRMLS_CC); zephir_array_update_string(&meta, SL("File"), &_8$$6, PH_COPY | PH_SEPARATE); } if (zephir_array_isset_string(lastTrace, SS("line"))) { zephir_array_fetch_string(&_9$$7, lastTrace, SL("line"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 137 TSRMLS_CC); zephir_array_update_string(&meta, SL("Line"), &_9$$7, PH_COPY | PH_SEPARATE); } zephir_is_iterable(backtrace, &_11$$4, &_10$$4, 1, 0, "phalcon/logger/formatter/firephp.zep", 146); for ( ; zephir_hash_get_current_data_ex(_11$$4, (void**) &_12$$4, &_10$$4) == SUCCESS ; zephir_hash_move_forward_ex(_11$$4, &_10$$4) ) { ZEPHIR_GET_HMKEY(key$$4, _11$$4, _10$$4); ZEPHIR_GET_HVALUE(backtraceItem$$4, _12$$4); zephir_array_unset_string(&backtraceItem$$4, SS("object"), PH_SEPARATE); zephir_array_unset_string(&backtraceItem$$4, SS("args"), PH_SEPARATE); zephir_array_update_zval(&backtrace, key$$4, &backtraceItem$$4, PH_COPY | PH_SEPARATE); } zend_hash_destroy(_11$$4); FREE_HASHTABLE(_11$$4); } _13 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (zephir_is_true(_13)) { zephir_array_update_string(&meta, SL("Label"), &message, PH_COPY | PH_SEPARATE); } _14 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _15 = !zephir_is_true(_14); if (_15) { _16 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _15 = !zephir_is_true(_16); } _17 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _18 = zephir_is_true(_17); if (_18) { _19 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _18 = !zephir_is_true(_19); } if (_15) { ZEPHIR_CPY_WRT(body, message); } else if (_18) { ZEPHIR_INIT_NVAR(body); ZVAL_STRING(body, "", 1); } else { ZEPHIR_INIT_NVAR(body); array_init(body); _20$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_20$$12)) { zephir_array_update_string(&body, SL("backtrace"), &backtrace, PH_COPY | PH_SEPARATE); } _21$$12 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (!(zephir_is_true(_21$$12))) { zephir_array_update_string(&body, SL("message"), &message, PH_COPY | PH_SEPARATE); } } ZEPHIR_INIT_VAR(_22); zephir_create_array(_22, 2, 0 TSRMLS_CC); zephir_array_fast_append(_22, meta); zephir_array_fast_append(_22, body); ZEPHIR_INIT_VAR(encoded); zephir_json_encode(encoded, &(encoded), _22, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(len); ZVAL_LONG(len, zephir_fast_strlen_ev(encoded)); ZEPHIR_CONCAT_VSVS(return_value, len, "|", encoded, "|"); RETURN_MM(); }
PHP_METHOD(Test_Globals, getDefaultGlobals4) { RETURN_BOOL(ZEPHIR_GLOBAL(my_setting_1)); }
/** * Handles uncaught exceptions */ PHP_METHOD(Phalcon_Debug, onUncaughtException) { zephir_fcall_cache_entry *_34 = NULL; HashTable *_13, *_18, *_22, *_26, *_30; HashPosition _12, _17, _21, _25, _29; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_1 = NULL, *_16 = NULL, *_24 = NULL, *_28 = NULL; zval *exception, *obLevel = NULL, *className, *escapedMessage = NULL, *html, *showBackTrace, *dataVars, *n = NULL, *traceItem = NULL, *keyRequest = NULL, *value = NULL, *keyServer = NULL, *keyFile = NULL, *keyVar = NULL, *dataVar = NULL, *_2, *_3 = NULL, *_4 = NULL, *_5, *_6 = NULL, *_7, *_8 = NULL, *_9 = NULL, *_10, *_11 = NULL, **_14, *_15 = NULL, *_REQUEST, **_19, *_20 = NULL, *_SERVER, **_23, **_27, **_31, *_32 = NULL, *_33, *_35 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &exception); ZEPHIR_CALL_FUNCTION(&obLevel, "ob_get_level", &_0); zephir_check_call_status(); if (ZEPHIR_GT_LONG(obLevel, 0)) { ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", &_1); zephir_check_call_status(); } _2 = zephir_fetch_static_property_ce(phalcon_debug_ce, SL("_isActive") TSRMLS_CC); if (zephir_is_true(_2)) { ZEPHIR_CALL_METHOD(&_3, exception, "getmessage", NULL); zephir_check_call_status(); zend_print_zval(_3, 0); RETURN_MM_NULL(); } zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &(ZEPHIR_GLOBAL(global_true)) TSRMLS_CC); ZEPHIR_INIT_VAR(className); zephir_get_class(className, exception, 0 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_3, exception, "getmessage", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&escapedMessage, this_ptr, "_escapestring", NULL, _3); zephir_check_call_status(); ZEPHIR_INIT_VAR(html); ZEPHIR_CONCAT_SVSVS(html, "<html><head><title>", className, ": ", escapedMessage, "</title>"); ZEPHIR_CALL_METHOD(&_4, this_ptr, "getcsssources", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(_5); ZEPHIR_CONCAT_VS(_5, _4, "</head><body>"); zephir_concat_self(&html, _5 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_6, this_ptr, "getversion", NULL); zephir_check_call_status(); zephir_concat_self(&html, _6 TSRMLS_CC); zephir_concat_self_str(&html, SL("<div align=\"center\"><div class=\"error-main\">") TSRMLS_CC); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SVSVS(_7, "<h1>", className, ": ", escapedMessage, "</h1>"); zephir_concat_self(&html, _7 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_8, exception, "getfile", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_9, exception, "getline", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(_10); ZEPHIR_CONCAT_SVSVS(_10, "<span class=\"error-file\">", _8, " (", _9, ")</span>"); zephir_concat_self(&html, _10 TSRMLS_CC); zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC); ZEPHIR_OBS_VAR(showBackTrace); zephir_read_property_this(&showBackTrace, this_ptr, SL("_showBackTrace"), PH_NOISY_CC); if (zephir_is_true(showBackTrace)) { ZEPHIR_OBS_VAR(dataVars); zephir_read_property_this(&dataVars, this_ptr, SL("_data"), PH_NOISY_CC); zephir_concat_self_str(&html, SL("<div class=\"error-info\"><div id=\"tabs\"><ul>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-1\">Backtrace</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-2\">Request</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-3\">Server</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-4\">Included Files</a></li>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-5\">Memory</a></li>") TSRMLS_CC); if (Z_TYPE_P(dataVars) == IS_ARRAY) { zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-6\">Variables</a></li>") TSRMLS_CC); } zephir_concat_self_str(&html, SL("</ul>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-1\"><table cellspacing=\"0\" align=\"center\" width=\"100%\">") TSRMLS_CC); ZEPHIR_CALL_METHOD(&_11, exception, "gettrace", NULL); zephir_check_call_status(); zephir_is_iterable(_11, &_13, &_12, 0, 0, "phalcon/debug.zep", 677); for ( ; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS ; zephir_hash_move_forward_ex(_13, &_12) ) { ZEPHIR_GET_HMKEY(n, _13, _12); ZEPHIR_GET_HVALUE(traceItem, _14); ZEPHIR_CALL_METHOD(&_15, this_ptr, "showtraceitem", &_16, n, traceItem); zephir_check_call_status(); zephir_concat_self(&html, _15 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-2\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_get_global(&_REQUEST, SS("_REQUEST") TSRMLS_CC); zephir_is_iterable(_REQUEST, &_18, &_17, 0, 0, "phalcon/debug.zep", 687); for ( ; zephir_hash_get_current_data_ex(_18, (void**) &_19, &_17) == SUCCESS ; zephir_hash_move_forward_ex(_18, &_17) ) { ZEPHIR_GET_HMKEY(keyRequest, _18, _17); ZEPHIR_GET_HVALUE(value, _19); ZEPHIR_INIT_LNVAR(_20); ZEPHIR_CONCAT_SVSVS(_20, "<tr><td class=\"key\">", keyRequest, "</td><td>", value, "</td></tr>"); zephir_concat_self(&html, _20 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-3\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC); zephir_is_iterable(_SERVER, &_22, &_21, 0, 0, "phalcon/debug.zep", 697); for ( ; zephir_hash_get_current_data_ex(_22, (void**) &_23, &_21) == SUCCESS ; zephir_hash_move_forward_ex(_22, &_21) ) { ZEPHIR_GET_HMKEY(keyServer, _22, _21); ZEPHIR_GET_HVALUE(value, _23); ZEPHIR_INIT_LNVAR(_20); ZEPHIR_CONCAT_SVSVS(_20, "<tr><td class=\"key\">", keyServer, "</td><td>", value, "</td></tr>"); zephir_concat_self(&html, _20 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-4\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>#</th><th>Path</th></tr>") TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_15, "get_included_files", &_24); zephir_check_call_status(); zephir_is_iterable(_15, &_26, &_25, 0, 0, "phalcon/debug.zep", 708); for ( ; zephir_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS ; zephir_hash_move_forward_ex(_26, &_25) ) { ZEPHIR_GET_HMKEY(keyFile, _26, _25); ZEPHIR_GET_HVALUE(value, _27); ZEPHIR_INIT_LNVAR(_20); ZEPHIR_CONCAT_SVSVS(_20, "<tr><td>", keyFile, "</th><td>", value, "</td></tr>"); zephir_concat_self(&html, _20 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); zephir_concat_self_str(&html, SL("<div id=\"error-tabs-5\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_15, "memory_get_usage", &_28, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_20); ZEPHIR_CONCAT_SVS(_20, "<tr><th colspan=\"2\">Memory</th></tr><tr><td>Usage</td><td>", _15, "</td></tr>"); zephir_concat_self(&html, _20 TSRMLS_CC); zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); if (Z_TYPE_P(dataVars) == IS_ARRAY) { zephir_concat_self_str(&html, SL("<div id=\"error-tabs-6\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC); zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC); zephir_is_iterable(dataVars, &_30, &_29, 0, 0, "phalcon/debug.zep", 726); for ( ; zephir_hash_get_current_data_ex(_30, (void**) &_31, &_29) == SUCCESS ; zephir_hash_move_forward_ex(_30, &_29) ) { ZEPHIR_GET_HMKEY(keyVar, _30, _29); ZEPHIR_GET_HVALUE(dataVar, _31); zephir_array_fetch_long(&_33, dataVar, 0, PH_NOISY | PH_READONLY, "phalcon/debug.zep", 724 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_32, this_ptr, "_getvardump", &_34, _33); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_35); ZEPHIR_CONCAT_SVSVS(_35, "<tr><td class=\"key\">", keyVar, "</td><td>", _32, "</td></tr>"); zephir_concat_self(&html, _35 TSRMLS_CC); } zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC); } zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_3, this_ptr, "getjssources", NULL); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_20); ZEPHIR_CONCAT_VS(_20, _3, "</div></body></html>"); zephir_concat_self(&html, _20 TSRMLS_CC); zend_print_zval(html, 0); zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &(ZEPHIR_GLOBAL(global_false)) TSRMLS_CC); RETURN_MM_BOOL(1); }
/** * Stores cached content into the file backend and stops the frontend * * <code> * $cache->save("my-key", $data); * * // Save data termlessly * $cache->save("my-key", $data, -1); * </code> * * @param int|string keyName * @param string content * @param int lifetime * @param boolean stopBuffer */ PHP_METHOD(Phalcon_Cache_Backend_Redis, save) { zend_long ZEPHIR_LAST_CALL_STATUS; zend_bool stopBuffer; zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *prefixedKey = NULL, *lastKey = NULL, *frontend = NULL, *redis = NULL, *cachedContent = NULL, *preparedContent = NULL, *tmp = NULL, *tt1 = NULL, *success = NULL, *options = NULL, *specialKey = NULL, *isBuffering = NULL, _0$$3, *_1$$4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!content) { content = ZEPHIR_GLOBAL(global_null); } if (!lifetime) { lifetime = ZEPHIR_GLOBAL(global_null); } if (!stopBuffer_param) { stopBuffer = 1; } else { stopBuffer = zephir_get_boolval(stopBuffer_param); } if (Z_TYPE_P(keyName) == IS_NULL) { ZEPHIR_OBS_VAR(lastKey); zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_0$$3); ZVAL_LONG(&_0$$3, 5); ZEPHIR_INIT_VAR(prefixedKey); zephir_substr(prefixedKey, lastKey, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); } else { _1$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(prefixedKey); ZEPHIR_CONCAT_VV(prefixedKey, _1$$4, keyName); ZEPHIR_INIT_NVAR(lastKey); ZEPHIR_CONCAT_SV(lastKey, "_PHCR", prefixedKey); zephir_update_property_this(getThis(), SL("_lastKey"), lastKey TSRMLS_CC); } if (!(zephir_is_true(lastKey))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache must be started first", "phalcon/cache/backend/redis.zep", 210); return; } ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); ZEPHIR_OBS_VAR(redis); zephir_read_property_this(&redis, this_ptr, SL("_redis"), PH_NOISY_CC); if (Z_TYPE_P(redis) != IS_OBJECT) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "_connect", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(redis); zephir_read_property_this(&redis, this_ptr, SL("_redis"), PH_NOISY_CC); } if (Z_TYPE_P(content) == IS_NULL) { ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(cachedContent, content); } if (!(zephir_is_numeric(cachedContent))) { ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(preparedContent, cachedContent); } if (Z_TYPE_P(lifetime) == IS_NULL) { ZEPHIR_OBS_VAR(tmp); zephir_read_property_this(&tmp, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (!(zephir_is_true(tmp))) { ZEPHIR_CALL_METHOD(&tt1, frontend, "getlifetime", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(tt1, tmp); } } else { ZEPHIR_CPY_WRT(tt1, lifetime); } ZEPHIR_CALL_METHOD(&success, redis, "set", NULL, 0, lastKey, preparedContent); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed storing the data in redis", "phalcon/cache/backend/redis.zep", 254); return; } if (ZEPHIR_GE_LONG(tt1, 1)) { ZEPHIR_CALL_METHOD(NULL, redis, "settimeout", NULL, 0, lastKey, tt1); zephir_check_call_status(); } ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_OBS_VAR(specialKey); if (!(zephir_array_isset_string_fetch(&specialKey, options, SS("statsKey"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 265); return; } if (!ZEPHIR_IS_STRING(specialKey, "")) { ZEPHIR_CALL_METHOD(NULL, redis, "sadd", NULL, 0, specialKey, prefixedKey); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL, 0); zephir_check_call_status(); if (stopBuffer == 1) { ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL, 0); zephir_check_call_status(); } if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) { zend_print_zval(cachedContent, 0); } if (0) { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_CCTOR(success); }
/** * Stores cached content into the APCu backend and stops the frontend * * @param string|int keyName * @param string content * @param int lifetime * @param boolean stopBuffer */ PHP_METHOD(Phalcon_Cache_Backend_Apcu, save) { zend_long ZEPHIR_LAST_CALL_STATUS; zend_bool stopBuffer; zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastKey = NULL, *frontend = NULL, *cachedContent = NULL, *preparedContent = NULL, *ttl = NULL, *isBuffering = NULL, *success = NULL, *_0$$4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!content) { content = ZEPHIR_GLOBAL(global_null); } if (!lifetime) { ZEPHIR_CPY_WRT(lifetime, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(lifetime); } if (!stopBuffer_param) { stopBuffer = 1; } else { stopBuffer = zephir_get_boolval(stopBuffer_param); } if (Z_TYPE_P(keyName) == IS_NULL) { ZEPHIR_OBS_VAR(lastKey); zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC); } else { _0$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(lastKey); ZEPHIR_CONCAT_SVV(lastKey, "_PHCA", _0$$4, keyName); } if (!(zephir_is_true(lastKey))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/apcu.zep", 95); return; } ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (Z_TYPE_P(content) == IS_NULL) { ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(cachedContent, content); } if (!(zephir_is_numeric(cachedContent))) { ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(preparedContent, cachedContent); } if (Z_TYPE_P(lifetime) == IS_NULL) { ZEPHIR_OBS_NVAR(lifetime); zephir_read_property_this(&lifetime, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (Z_TYPE_P(lifetime) == IS_NULL) { ZEPHIR_CALL_METHOD(&ttl, frontend, "getlifetime", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(ttl, lifetime); zephir_update_property_this(getThis(), SL("_lastKey"), lastKey TSRMLS_CC); } } else { ZEPHIR_CPY_WRT(ttl, lifetime); } ZEPHIR_CALL_FUNCTION(&success, "apcu_store", NULL, 91, lastKey, preparedContent, ttl); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed storing data in APCu", "phalcon/cache/backend/apcu.zep", 132); return; } ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL, 0); zephir_check_call_status(); if (stopBuffer == 1) { ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL, 0); zephir_check_call_status(); } if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) { zend_print_zval(cachedContent, 0); } if (0) { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_CCTOR(success); }
/** * Returns a cached content * * @param int|string keyName * @param int lifetime * @return mixed */ PHP_METHOD(Phalcon_Cache_Backend_File, get) { zephir_nts_static zephir_fcall_cache_entry *_8 = NULL; int ttl, modifiedTime, ZEPHIR_LAST_CALL_STATUS; zval *keyName, *lifetime = NULL, *prefixedKey, *cacheDir, *cacheFile, *frontend, *lastLifetime, *cachedContent, *ret = NULL, *_0, *_1 = NULL, *_2, *_3 = NULL, *_4, *_5, *_6, *_7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &keyName, &lifetime); if (!lifetime) { lifetime = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkey", NULL, keyName); zephir_check_call_status(); ZEPHIR_INIT_VAR(prefixedKey); ZEPHIR_CONCAT_VV(prefixedKey, _0, _1); zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC); ZEPHIR_OBS_VAR(cacheDir); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (!(zephir_array_isset_string_fetch(&cacheDir, _2, SS("cacheDir"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/file.zep", 115); return; } ZEPHIR_INIT_VAR(cacheFile); ZEPHIR_CONCAT_VV(cacheFile, cacheDir, prefixedKey); if ((zephir_file_exists(cacheFile TSRMLS_CC) == SUCCESS) == 1) { ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); if (!(zephir_is_true(lifetime))) { ZEPHIR_OBS_VAR(lastLifetime); zephir_read_property_this(&lastLifetime, this_ptr, SL("_lastLifetime"), PH_NOISY_CC); if (!(zephir_is_true(lastLifetime))) { ZEPHIR_CALL_METHOD(&_3, frontend, "getlifetime", NULL); zephir_check_call_status(); ttl = zephir_get_intval(_3); } else { ttl = zephir_get_intval(lastLifetime); } } else { ttl = zephir_get_intval(lifetime); } ZEPHIR_INIT_VAR(_4); zephir_filemtime(_4, cacheFile TSRMLS_CC); modifiedTime = zephir_get_intval(_4); ZEPHIR_INIT_VAR(_5); zephir_time(_5); if (!((zephir_get_numberval(_5) - ttl) > modifiedTime)) { ZEPHIR_INIT_VAR(cachedContent); zephir_file_get_contents(cachedContent, cacheFile TSRMLS_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(cachedContent)) { ZEPHIR_INIT_VAR(_6); object_init_ex(_6, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_7); ZEPHIR_CONCAT_SVS(_7, "Cache file ", cacheFile, " could not be opened"); ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7); zephir_check_call_status(); zephir_throw_exception_debug(_6, "phalcon/cache/backend/file.zep", 151 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_is_numeric(cachedContent)) { RETURN_CCTOR(cachedContent); } else { ZEPHIR_CALL_METHOD(&ret, frontend, "afterretrieve", NULL, cachedContent); zephir_check_call_status(); RETURN_CCTOR(ret); } } } ZEPHIR_MM_RESTORE(); }
/** * @brief Reads an item from @a arr at position @a index and stores it to @a return_value * @param return_value[out] Return value * @param arr Array * @param index Index * @param silent 0 to suppress all warnings, @c PH_NOISY to enable * @return Whether the operation succeeded * @retval @c FAILURE Failure, @a arr is not an array * @retval @c SUCCESS Success * @throw @c E_WARNING if @c arr is not an array and @c silent = @c PH_NOISY * @throw @c E_WARNING if @c index is not of the supported type and @c silent = @c PH_NOISY * @throw @c E_NOTICE if @c index does not exist and @c silent = @c PH_NOISY * @warning @c *return_value should be either @c NULL (preferred) or point to not initialized memory; if @c *return_value points to a valid variable, mmemory leak is possible * @note @c index will be handled as follows: @c NULL is treated as an empty string, @c double values are cast to @c integer, @c bool or @c resource are treated as @c integer */ int zephir_array_fetch(zval **return_value, zval *arr, zval *index, int flags TSRMLS_DC){ zval **zv; HashTable *ht; int result; ulong uidx = 0; char *sidx = NULL; if (Z_TYPE_P(arr) == IS_ARRAY) { ht = Z_ARRVAL_P(arr); switch (Z_TYPE_P(index)) { case IS_NULL: result = zephir_hash_find(ht, ZEND_STRS(""), (void**) &zv); sidx = ""; break; case IS_DOUBLE: uidx = (ulong)Z_DVAL_P(index); result = zend_hash_index_find(ht, uidx, (void**) &zv); break; case IS_LONG: case IS_BOOL: case IS_RESOURCE: uidx = Z_LVAL_P(index); result = zend_hash_index_find(ht, uidx, (void**) &zv); break; case IS_STRING: sidx = Z_STRLEN_P(index) ? Z_STRVAL_P(index) : ""; result = zend_symtable_find(ht, Z_STRVAL_P(index), Z_STRLEN_P(index)+1, (void**) &zv); break; default: if ((flags & PH_NOISY) == PH_NOISY) { zend_error(E_WARNING, "Illegal offset type"); } result = FAILURE; break; } if (result != FAILURE) { *return_value = *zv; if ((flags & PH_READONLY) != PH_READONLY) { Z_ADDREF_PP(return_value); } return SUCCESS; } if ((flags & PH_NOISY) == PH_NOISY) { if (sidx == NULL) { zend_error(E_NOTICE, "Undefined index: %ld", uidx); } else { zend_error(E_NOTICE, "Undefined index: %s", sidx); } } } *return_value = ZEPHIR_GLOBAL(global_null); return FAILURE; }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { zend_class_entry *_13$$15; HashTable *_3, *_6$$11; HashPosition _2, _5$$11; zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); if (zephir_is_true(_0)) { zephir_update_property_this(getThis(), SL("_activeRow"), row TSRMLS_CC); RETURN_CCTOR(row); } if (Z_TYPE_P(row) != IS_ARRAY) { if (0) { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_INIT_NVAR(activeRow); object_init_ex(activeRow, phalcon_mvc_model_row_ce); if (zephir_has_constructor(activeRow TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); zephir_check_call_status(); } break; } if (ZEPHIR_IS_LONG(hydrateMode, 1)) { ZEPHIR_INIT_NVAR(activeRow); array_init(activeRow); break; } ZEPHIR_INIT_NVAR(activeRow); object_init(activeRow); break; } while(0); dirtyState = 0; _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HMKEY(alias, _3, _2); ZEPHIR_GET_HVALUE(column, _4); if (Z_TYPE_P(column) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); return; } ZEPHIR_OBS_NVAR(type); zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); if (ZEPHIR_IS_STRING(type, "object")) { ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); ZEPHIR_OBS_NVAR(attributes); zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnMap); zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); ZEPHIR_INIT_NVAR(rowModel); array_init(rowModel); zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); for ( ; zend_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS ; zend_hash_move_forward_ex(_6$$11, &_5$$11) ) { ZEPHIR_GET_HVALUE(attribute, _7$$11); ZEPHIR_OBS_NVAR(columnValue); ZEPHIR_INIT_LNVAR(_8$$12); ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); } do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_OBS_NVAR(keepSnapshots); if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(keepSnapshots); ZVAL_BOOL(keepSnapshots, 0); } if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_OBS_NVAR(_9$$15); zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); ZEPHIR_INIT_NVAR(modelName); zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); } zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); ZEPHIR_INIT_NVAR(_12$$15); ZVAL_LONG(_12$$15, dirtyState); _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); zephir_check_call_status(); } else { zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); ZEPHIR_INIT_NVAR(_16$$18); ZVAL_LONG(_16$$18, dirtyState); ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); ZEPHIR_OBS_NVAR(attribute); zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(sqlAlias); if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(value); zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); } if (zephir_array_isset_string(column, SS("balias"))) { ZEPHIR_CPY_WRT(attribute, alias); } else { ZEPHIR_SINIT_NVAR(_18$$24); ZVAL_STRING(&_18$$24, "_", 0); ZEPHIR_SINIT_NVAR(_19$$24); ZVAL_STRING(&_19$$24, "", 0); ZEPHIR_INIT_NVAR(attribute); zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); } } if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { do { if (ZEPHIR_IS_LONG(hydrateMode, 1)) { zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); break; } zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); break; } while(0); } } zephir_update_property_this(getThis(), SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Set an specific argument */ PHP_METHOD(Phalcon_Cli_Console, setArgument) { HashTable *_2; HashPosition _1; zephir_fcall_cache_entry *_7 = NULL, *_26 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zend_bool str, shift, _0; zval *arguments_param = NULL, *str_param = NULL, *shift_param = NULL, *arg = NULL, *pos = NULL, *args = NULL, *opts = NULL, *handleArgs = NULL, **_3, _4$$5 = zval_used_for_init, _5$$5 = zval_used_for_init, *_6$$5 = NULL, _8$$6 = zval_used_for_init, *_9$$7 = NULL, _10$$7 = zval_used_for_init, *_11$$7 = NULL, *_12$$7 = NULL, _13$$7 = zval_used_for_init, _14$$7 = zval_used_for_init, *_15$$7 = NULL, *_16$$8 = NULL, _17$$8 = zval_used_for_init, *_18$$8 = NULL, _19$$9 = zval_used_for_init, _20$$9 = zval_used_for_init, *_21$$9 = NULL, _22$$10 = zval_used_for_init, *_23$$10 = NULL, *_24$$13, *_25$$13 = NULL, *_27$$15 = NULL, *_28$$16 = NULL, *_29$$17; zval *arguments = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 3, &arguments_param, &str_param, &shift_param); if (!arguments_param) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); } else { arguments = arguments_param; } if (!str_param) { str = 1; } else { if (UNEXPECTED(Z_TYPE_P(str_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } str = Z_BVAL_P(str_param); } if (!shift_param) { shift = 1; } else { if (UNEXPECTED(Z_TYPE_P(shift_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'shift' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } shift = Z_BVAL_P(shift_param); } ZEPHIR_INIT_VAR(args); array_init(args); ZEPHIR_INIT_VAR(opts); array_init(opts); ZEPHIR_INIT_VAR(handleArgs); array_init(handleArgs); _0 = shift; if (_0) { _0 = ((zephir_fast_count_int(arguments TSRMLS_CC)) ? 1 : 0); } if (_0) { ZEPHIR_MAKE_REF(arguments); ZEPHIR_CALL_FUNCTION(NULL, "array_shift", NULL, 19, arguments); ZEPHIR_UNREF(arguments); zephir_check_call_status(); } zephir_is_iterable(arguments, &_2, &_1, 0, 0, "phalcon/cli/console.zep", 201); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(arg, _3); if (Z_TYPE_P(arg) == IS_STRING) { ZEPHIR_SINIT_NVAR(_4$$5); ZVAL_STRING(&_4$$5, "--", 0); ZEPHIR_SINIT_NVAR(_5$$5); ZVAL_LONG(&_5$$5, 2); ZEPHIR_CALL_FUNCTION(&_6$$5, "strncmp", &_7, 137, arg, &_4$$5, &_5$$5); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_6$$5, 0)) { ZEPHIR_SINIT_NVAR(_8$$6); ZVAL_STRING(&_8$$6, "=", 0); ZEPHIR_INIT_NVAR(pos); zephir_fast_strpos(pos, arg, &_8$$6, 0 ); if (zephir_is_true(pos)) { ZEPHIR_INIT_NVAR(_9$$7); ZEPHIR_SINIT_NVAR(_10$$7); ZVAL_LONG(&_10$$7, (zephir_get_numberval(pos) + 1)); ZEPHIR_INIT_NVAR(_11$$7); zephir_substr(_11$$7, arg, zephir_get_intval(&_10$$7), 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_fast_trim(_9$$7, _11$$7, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_NVAR(_12$$7); ZEPHIR_SINIT_NVAR(_13$$7); ZVAL_LONG(&_13$$7, 2); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_LONG(&_14$$7, (zephir_get_numberval(pos) - 2)); ZEPHIR_INIT_NVAR(_15$$7); zephir_substr(_15$$7, arg, 2 , zephir_get_intval(&_14$$7), 0); zephir_fast_trim(_12$$7, _15$$7, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); zephir_array_update_zval(&opts, _12$$7, &_9$$7, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(_16$$8); ZEPHIR_SINIT_NVAR(_17$$8); ZVAL_LONG(&_17$$8, 2); ZEPHIR_INIT_NVAR(_18$$8); zephir_substr(_18$$8, arg, 2 , 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_fast_trim(_16$$8, _18$$8, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); zephir_array_update_zval(&opts, _16$$8, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } } else { ZEPHIR_SINIT_NVAR(_19$$9); ZVAL_STRING(&_19$$9, "-", 0); ZEPHIR_SINIT_NVAR(_20$$9); ZVAL_LONG(&_20$$9, 1); ZEPHIR_CALL_FUNCTION(&_21$$9, "strncmp", &_7, 137, arg, &_19$$9, &_20$$9); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_21$$9, 0)) { ZEPHIR_SINIT_NVAR(_22$$10); ZVAL_LONG(&_22$$10, 1); ZEPHIR_INIT_NVAR(_23$$10); zephir_substr(_23$$10, arg, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_array_update_zval(&opts, _23$$10, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_append(&args, arg, PH_SEPARATE, "phalcon/cli/console.zep", 193); } } } else { zephir_array_append(&args, arg, PH_SEPARATE, "phalcon/cli/console.zep", 197); } } if (str) { ZEPHIR_INIT_VAR(_24$$13); ZEPHIR_CALL_CE_STATIC(&_25$$13, phalcon_cli_router_route_ce, "getdelimiter", &_26, 138); zephir_check_call_status(); zephir_fast_join(_24$$13, _25$$13, args TSRMLS_CC); zephir_update_property_this(getThis(), SL("_arguments"), _24$$13 TSRMLS_CC); } else { if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_MAKE_REF(args); ZEPHIR_CALL_FUNCTION(&_27$$15, "array_shift", NULL, 19, args); ZEPHIR_UNREF(args); zephir_check_call_status(); zephir_array_update_string(&handleArgs, SL("task"), &_27$$15, PH_COPY | PH_SEPARATE); } if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_MAKE_REF(args); ZEPHIR_CALL_FUNCTION(&_28$$16, "array_shift", NULL, 19, args); ZEPHIR_UNREF(args); zephir_check_call_status(); zephir_array_update_string(&handleArgs, SL("action"), &_28$$16, PH_COPY | PH_SEPARATE); } if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_INIT_VAR(_29$$17); zephir_fast_array_merge(_29$$17, &(handleArgs), &(args) TSRMLS_CC); ZEPHIR_CPY_WRT(handleArgs, _29$$17); } zephir_update_property_this(getThis(), SL("_arguments"), handleArgs TSRMLS_CC); } zephir_update_property_this(getThis(), SL("_options"), opts TSRMLS_CC); RETURN_THIS(); }
/** * Check if the CSRF token sent in the request is the same that the current in session */ PHP_METHOD(Phalcon_Security, checkToken) { int ZEPHIR_LAST_CALL_STATUS; zend_bool destroyIfValid, returnValue = 0, _5; zval *tokenKey = NULL, *tokenValue = NULL, *destroyIfValid_param = NULL, *dependencyInjector = NULL, *session = NULL, *request = NULL, *token = NULL, *_0, *_1 = NULL, *_2, *_3$$4, *_4$$6, *_6$$8, *_7$$8; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 3, &tokenKey, &tokenValue, &destroyIfValid_param); if (!tokenKey) { ZEPHIR_CPY_WRT(tokenKey, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(tokenKey); } if (!tokenValue) { tokenValue = ZEPHIR_GLOBAL(global_null); } if (!destroyIfValid_param) { destroyIfValid = 1; } else { destroyIfValid = zephir_get_boolval(destroyIfValid_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_security_exception_ce, "A dependency injection container is required to access the 'session' service", "phalcon/security.zep", 348); return; } ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "session", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1, dependencyInjector, "getshared", NULL, 0, _2); zephir_check_temp_parameter(_2); zephir_check_call_status(); ZEPHIR_CPY_WRT(session, _1); if (!(zephir_is_true(tokenKey))) { _3$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_tokenKeySessionID"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&tokenKey, session, "get", NULL, 0, _3$$4); zephir_check_call_status(); } if (!(zephir_is_true(tokenKey))) { RETURN_MM_BOOL(0); } if (!(zephir_is_true(tokenValue))) { ZEPHIR_INIT_VAR(_4$$6); ZVAL_STRING(_4$$6, "request", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&request, dependencyInjector, "getshared", NULL, 0, _4$$6); zephir_check_temp_parameter(_4$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&token, request, "getpost", NULL, 0, tokenKey); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(token, tokenValue); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_tokenValueSessionID"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, session, "get", NULL, 0, _0); zephir_check_call_status(); returnValue = ZEPHIR_IS_EQUAL(token, _1); _5 = returnValue; if (_5) { _5 = destroyIfValid; } if (_5) { _6$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_tokenKeySessionID"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, session, "remove", NULL, 0, _6$$8); zephir_check_call_status(); _7$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_tokenValueSessionID"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, session, "remove", NULL, 0, _7$$8); zephir_check_call_status(); } RETURN_MM_BOOL(returnValue); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_class_entry *_4; zval *row, *hydrateMode, *columnMap, *activeRow = NULL, *modelName = NULL, *_0, *_1, *_2, *_3 = NULL, *_6; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(row) != IS_ARRAY) { zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_model"), PH_NOISY_CC); if (zephir_instance_of_ev(_0, phalcon_mvc_model_ce TSRMLS_CC)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); ZEPHIR_INIT_VAR(modelName); zephir_get_class(modelName, _1, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 0); _4 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&activeRow, _4, "cloneresultmap", NULL, 0, _1, row, columnMap, _3, _2); zephir_check_call_status(); } else { _2 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 0); ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_5, 352, _2, row, columnMap, _3, _6); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_7, 353, row, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Returns a complete resultset as an array, if the resultset has a big number of rows * it could consume more memory than currently it does. Export the resultset to an array * couldn't be faster with a large number of records */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { zephir_fcall_cache_entry *_9 = NULL; HashTable *_2, *_5; HashPosition _1, _4; int ZEPHIR_LAST_CALL_STATUS; zval *renameColumns_param = NULL, *result, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords, *columnMap, *_0, **_3, **_6, *_7 = NULL, *_8 = NULL, *_10 = NULL; zend_bool renameColumns; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &renameColumns_param); if (!renameColumns_param) { renameColumns = 1; } else { renameColumns = zephir_get_boolval(renameColumns_param); } ZEPHIR_OBS_VAR(records); zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(records) != IS_ARRAY) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(_0) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); } if (renameColumns) { ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); if (Z_TYPE_P(columnMap) != IS_ARRAY) { RETURN_CCTOR(records); } ZEPHIR_INIT_VAR(renamedRecords); array_init(renamedRecords); if (Z_TYPE_P(records) == IS_ARRAY) { zephir_is_iterable(records, &_2, &_1, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 220); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(record, _3); ZEPHIR_INIT_NVAR(renamed); array_init(renamed); zephir_is_iterable(record, &_5, &_4, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 218); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(key, _5, _4); ZEPHIR_GET_HVALUE(value, _6); ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_8); ZEPHIR_CONCAT_SVS(_8, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_9, 9, _8); zephir_check_call_status(); zephir_throw_exception_debug(_7, "phalcon/mvc/model/resultset/simple.zep", 200 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(renamedKey) == IS_ARRAY) { ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_8); ZEPHIR_CONCAT_SVS(_8, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_9, 9, _8); zephir_check_call_status(); zephir_throw_exception_debug(_7, "phalcon/mvc/model/resultset/simple.zep", 206 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_OBS_NVAR(_10); zephir_array_fetch_long(&_10, renamedKey, 0, PH_NOISY, "phalcon/mvc/model/resultset/simple.zep", 209 TSRMLS_CC); zephir_array_update_zval(&renamed, _10, &value, PH_COPY | PH_SEPARATE); } else { zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); } } zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 218); } } RETURN_CCTOR(renamedRecords); } RETURN_CCTOR(records); }
/** * The meta-data is obtained by reading the column descriptions from the database information schema */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getMetaData) { zend_bool _16$$9; HashTable *_8; HashPosition _7; int ZEPHIR_LAST_CALL_STATUS; zval *model, *dependencyInjector, *schema = NULL, *table = NULL, *readConnection = NULL, *columns = NULL, *attributes = NULL, *primaryKeys = NULL, *nonPrimaryKeys = NULL, *completeTable = NULL, *numericTyped = NULL, *notNull = NULL, *fieldTypes = NULL, *automaticDefault = NULL, *identityField = NULL, *fieldBindTypes = NULL, *defaultValues = NULL, *column = NULL, *fieldName = NULL, *defaultValue = NULL, *emptyStringValues = NULL, *_0 = NULL, **_9, *_1$$3, *_2$$3, *_3$$3, *_4$$6, *_5$$6, *_6$$6, *_10$$9 = NULL, *_11$$9 = NULL, *_12$$9 = NULL, *_13$$9 = NULL, *_14$$9 = NULL, *_15$$9 = NULL, *_17$$9 = NULL, *_18$$15 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &model, &dependencyInjector); ZEPHIR_CALL_METHOD(&schema, model, "getschema", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&table, model, "getsource", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&readConnection, model, "getreadconnection", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, readConnection, "tableexists", NULL, 0, table, schema); zephir_check_call_status(); if (!(zephir_is_true(_0))) { if (zephir_is_true(schema)) { ZEPHIR_INIT_VAR(completeTable); ZEPHIR_CONCAT_VSV(completeTable, schema, "'.'", table); } else { ZEPHIR_CPY_WRT(completeTable, table); } ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_2$$3); zephir_get_class(_2$$3, model, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_CONCAT_SVSV(_3$$3, "Table '", completeTable, "' doesn't exist in database when dumping meta-data for ", _2$$3); ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _3$$3); zephir_check_call_status(); zephir_throw_exception_debug(_1$$3, "phalcon/mvc/model/metadata/strategy/introspection.zep", 68 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, readConnection, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); if (!(zephir_fast_count_int(columns TSRMLS_CC))) { if (zephir_is_true(schema)) { ZEPHIR_INIT_NVAR(completeTable); ZEPHIR_CONCAT_VSV(completeTable, schema, "'.'", table); } else { ZEPHIR_CPY_WRT(completeTable, table); } ZEPHIR_INIT_VAR(_4$$6); object_init_ex(_4$$6, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_5$$6); zephir_get_class(_5$$6, model, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_6$$6); ZEPHIR_CONCAT_SVSV(_6$$6, "Cannot obtain table columns for the mapped source '", completeTable, "' used in model ", _5$$6); ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", NULL, 9, _6$$6); zephir_check_call_status(); zephir_throw_exception_debug(_4$$6, "phalcon/mvc/model/metadata/strategy/introspection.zep", 88 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(attributes); array_init(attributes); ZEPHIR_INIT_VAR(primaryKeys); array_init(primaryKeys); ZEPHIR_INIT_VAR(nonPrimaryKeys); array_init(nonPrimaryKeys); ZEPHIR_INIT_VAR(numericTyped); array_init(numericTyped); ZEPHIR_INIT_VAR(notNull); array_init(notNull); ZEPHIR_INIT_VAR(fieldTypes); array_init(fieldTypes); ZEPHIR_INIT_VAR(fieldBindTypes); array_init(fieldBindTypes); ZEPHIR_INIT_VAR(automaticDefault); array_init(automaticDefault); ZEPHIR_INIT_VAR(identityField); ZVAL_BOOL(identityField, 0); ZEPHIR_INIT_VAR(defaultValues); array_init(defaultValues); ZEPHIR_INIT_VAR(emptyStringValues); array_init(emptyStringValues); zephir_is_iterable(columns, &_8, &_7, 0, 0, "phalcon/mvc/model/metadata/strategy/introspection.zep", 165); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(column, _9); ZEPHIR_CALL_METHOD(&fieldName, column, "getname", NULL, 0); zephir_check_call_status(); zephir_array_append(&attributes, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 109); ZEPHIR_CALL_METHOD(&_10$$9, column, "isprimary", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_10$$9)) { zephir_array_append(&primaryKeys, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 115); } else { zephir_array_append(&nonPrimaryKeys, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 117); } ZEPHIR_CALL_METHOD(&_11$$9, column, "isnumeric", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_11$$9)) { zephir_array_update_zval(&numericTyped, fieldName, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_CALL_METHOD(&_12$$9, column, "isnotnull", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_12$$9)) { zephir_array_append(¬Null, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 131); } ZEPHIR_CALL_METHOD(&_13$$9, column, "isautoincrement", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_13$$9)) { ZEPHIR_CPY_WRT(identityField, fieldName); } ZEPHIR_CALL_METHOD(&_14$$9, column, "gettype", NULL, 0); zephir_check_call_status(); zephir_array_update_zval(&fieldTypes, fieldName, &_14$$9, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(&_15$$9, column, "getbindtype", NULL, 0); zephir_check_call_status(); zephir_array_update_zval(&fieldBindTypes, fieldName, &_15$$9, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); zephir_check_call_status(); _16$$9 = Z_TYPE_P(defaultValue) != IS_NULL; if (!(_16$$9)) { ZEPHIR_CALL_METHOD(&_17$$9, column, "isnotnull", NULL, 0); zephir_check_call_status(); _16$$9 = ZEPHIR_IS_FALSE_IDENTICAL(_17$$9); } if (_16$$9) { ZEPHIR_CALL_METHOD(&_18$$15, column, "isautoincrement", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_18$$15))) { zephir_array_update_zval(&defaultValues, fieldName, &defaultValue, PH_COPY | PH_SEPARATE); } } } zephir_create_array(return_value, 12, 0 TSRMLS_CC); zephir_array_update_long(&return_value, 0, &attributes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 1, &primaryKeys, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 2, &nonPrimaryKeys, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 3, ¬Null, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 4, &fieldTypes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 5, &numericTyped, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 8, &identityField, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 9, &fieldBindTypes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 10, &automaticDefault, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 11, &automaticDefault, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 12, &defaultValues, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 13, &emptyStringValues, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); RETURN_MM(); }
/** * Gets a value from the internal related entity or from the default value */ PHP_METHOD(Phalcon_Forms_Form, getValue) { int ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *entity = NULL, *method = NULL, *value = NULL, *data = NULL, *internal = NULL, *forbidden = NULL, *_1, *_0$$4; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } ZEPHIR_OBS_VAR(entity); zephir_read_property_this(&entity, this_ptr, SL("_entity"), PH_NOISY_CC); ZEPHIR_OBS_VAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); if ((zephir_method_exists_ex(this_ptr, SS("getcustomvalue") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getcustomvalue", NULL, 0, name, entity, data); zephir_check_call_status(); RETURN_MM(); } if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_INIT_VAR(_0$$4); zephir_camelize(_0$$4, name, NULL ); ZEPHIR_INIT_VAR(method); ZEPHIR_CONCAT_SV(method, "get", _0$$4); if ((zephir_method_exists(entity, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD_ZVAL(entity, method, NULL, 0); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_OBS_VAR(value); if (zephir_fetch_property_zval(&value, entity, name, PH_SILENT_CC)) { RETURN_CCTOR(value); } } if (Z_TYPE_P(data) == IS_ARRAY) { ZEPHIR_OBS_NVAR(value); if (zephir_array_isset_fetch(&value, data, name, 0 TSRMLS_CC)) { RETURN_CCTOR(value); } } ZEPHIR_INIT_VAR(forbidden); zephir_create_array(forbidden, 12, 0 TSRMLS_CC); zephir_array_update_string(&forbidden, SL("validation"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("action"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("useroption"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("useroptions"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("entity"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("elements"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("messages"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("messagesfor"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("label"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("value"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("di"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("eventsmanager"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(internal); zephir_fast_strtolower(internal, name); if (zephir_array_isset(forbidden, internal)) { RETURN_MM_NULL(); } ZEPHIR_INIT_VAR(_1); zephir_camelize(_1, name, NULL ); ZEPHIR_INIT_NVAR(method); ZEPHIR_CONCAT_SV(method, "get", _1); if ((zephir_method_exists(this_ptr, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, method, NULL, 0); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_NULL(); }
/** * Generates a URL * *<code> * // Generate a URL appending the URI to the base URI * echo $url->get("products/edit/1"); * * // Generate a URL for a predefined route * echo $url->get( * [ * "for" => "blog-post", * "title" => "some-cool-stuff", * "year" => "2015", * ] * ); * * // Generate a URL with GET arguments (/show/products?id=1&name=Carrots) * echo $url->get( * "show/products", * [ * "id" => 1, * "name" => "Carrots", * ] * ); * * // Generate an absolute URL by setting the third parameter as false. * echo $url->get( * "https://phalconphp.com/", * null, * false * ); *</code> */ PHP_METHOD(Phalcon_Mvc_Url, get) { unsigned char _17$$14, _19$$14, _24$$16; zend_bool _0$$3, _1$$3, _15$$14, _16$$14, _18$$14, _22$$16, _23$$16, _25$$19; zval *strUri = NULL, *_14$$14 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *uri = NULL, *args = NULL, *local = NULL, *baseUri = NULL, *router = NULL, *dependencyInjector = NULL, *routeName = NULL, *route = NULL, *queryString = NULL, *_2$$4, *_3$$4, _4$$4, *_5$$9, *_9$$9 = NULL, *_12$$9, *_13$$9 = NULL, *_6$$11, *_7$$11 = NULL, *_8$$11, *_10$$13, *_11$$13, _20$$15, *_21$$15, _26$$20, *_27$$20, *_28$$21, *_29$$22; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &uri, &args, &local, &baseUri); if (!uri) { ZEPHIR_CPY_WRT(uri, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(uri); } if (!args) { args = ZEPHIR_GLOBAL(global_null); } if (!local) { ZEPHIR_CPY_WRT(local, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(local); } if (!baseUri) { ZEPHIR_CPY_WRT(baseUri, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(baseUri); } if (Z_TYPE_P(local) == IS_NULL) { _0$$3 = Z_TYPE_P(uri) == IS_STRING; if (_0$$3) { _1$$3 = zephir_memnstr_str(uri, SL("//"), "phalcon/mvc/url.zep", 208); if (!(_1$$3)) { _1$$3 = zephir_memnstr_str(uri, SL(":"), "phalcon/mvc/url.zep", 208); } _0$$3 = _1$$3; } if (_0$$3) { ZEPHIR_INIT_VAR(_2$$4); ZEPHIR_INIT_VAR(_3$$4); ZEPHIR_SINIT_VAR(_4$$4); ZVAL_STRING(&_4$$4, "#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i", 0); zephir_preg_match(_3$$4, &_4$$4, uri, _2$$4, 0, 0 , 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(local); if (zephir_is_true(_3$$4)) { ZVAL_BOOL(local, 0); } else { ZVAL_BOOL(local, 1); } } else { ZEPHIR_INIT_NVAR(local); ZVAL_BOOL(local, 1); } } if (Z_TYPE_P(baseUri) != IS_STRING) { ZEPHIR_CALL_METHOD(&baseUri, this_ptr, "getbaseuri", NULL, 0); zephir_check_call_status(); } if (Z_TYPE_P(uri) == IS_ARRAY) { ZEPHIR_OBS_VAR(routeName); if (!(zephir_array_isset_string_fetch(&routeName, uri, SS("for"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "It's necessary to define the route name with the parameter 'for'", "phalcon/mvc/url.zep", 226); return; } _5$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_router"), PH_NOISY_CC); ZEPHIR_CPY_WRT(router, _5$$9); if (Z_TYPE_P(router) != IS_OBJECT) { _6$$11 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _6$$11); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injector container is required to obtain the 'router' service", "phalcon/mvc/url.zep", 238); return; } ZEPHIR_INIT_VAR(_8$$11); ZVAL_STRING(_8$$11, "router", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_7$$11, dependencyInjector, "getshared", NULL, 0, _8$$11); zephir_check_temp_parameter(_8$$11); zephir_check_call_status(); ZEPHIR_CPY_WRT(router, _7$$11); zephir_update_property_this(getThis(), SL("_router"), router TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_9$$9, router, "getroutebyname", NULL, 0, routeName); zephir_check_call_status(); ZEPHIR_CPY_WRT(route, _9$$9); if (Z_TYPE_P(route) != IS_OBJECT) { ZEPHIR_INIT_VAR(_10$$13); object_init_ex(_10$$13, phalcon_mvc_url_exception_ce); ZEPHIR_INIT_VAR(_11$$13); ZEPHIR_CONCAT_SVS(_11$$13, "Cannot obtain a route using the name '", routeName, "'"); ZEPHIR_CALL_METHOD(NULL, _10$$13, "__construct", NULL, 9, _11$$13); zephir_check_call_status(); zephir_throw_exception_debug(_10$$13, "phalcon/mvc/url.zep", 250 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(_12$$9); ZEPHIR_CALL_METHOD(&_9$$9, route, "getpattern", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$9, route, "getreversedpaths", NULL, 0); zephir_check_call_status(); phalcon_replace_paths(_12$$9, _9$$9, _13$$9, uri TSRMLS_CC); ZEPHIR_CPY_WRT(uri, _12$$9); } if (zephir_is_true(local)) { zephir_get_strval(_14$$14, uri); ZEPHIR_CPY_WRT(strUri, _14$$14); _15$$14 = ZEPHIR_IS_STRING(baseUri, "/"); if (_15$$14) { _15$$14 = zephir_fast_strlen_ev(strUri) > 2; } _16$$14 = _15$$14; if (_16$$14) { _17$$14 = ZEPHIR_STRING_OFFSET(strUri, 0); _16$$14 = _17$$14 == '/'; } _18$$14 = _16$$14; if (_18$$14) { _19$$14 = ZEPHIR_STRING_OFFSET(strUri, 1); _18$$14 = _19$$14 != '/'; } if (_18$$14) { ZEPHIR_SINIT_VAR(_20$$15); ZVAL_LONG(&_20$$15, 1); ZEPHIR_INIT_VAR(_21$$15); zephir_substr(_21$$15, strUri, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_INIT_NVAR(uri); ZEPHIR_CONCAT_VV(uri, baseUri, _21$$15); } else { _22$$16 = ZEPHIR_IS_STRING(baseUri, "/"); if (_22$$16) { _22$$16 = zephir_fast_strlen_ev(strUri) == 1; } _23$$16 = _22$$16; if (_23$$16) { _24$$16 = ZEPHIR_STRING_OFFSET(strUri, 0); _23$$16 = _24$$16 == '/'; } if (_23$$16) { ZEPHIR_CPY_WRT(uri, baseUri); } else { ZEPHIR_INIT_NVAR(uri); ZEPHIR_CONCAT_VV(uri, baseUri, strUri); } } } if (zephir_is_true(args)) { ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 390, args); zephir_check_call_status(); _25$$19 = Z_TYPE_P(queryString) == IS_STRING; if (_25$$19) { _25$$19 = ((zephir_fast_strlen_ev(queryString)) ? 1 : 0); } if (_25$$19) { ZEPHIR_SINIT_VAR(_26$$20); ZVAL_STRING(&_26$$20, "?", 0); ZEPHIR_INIT_VAR(_27$$20); zephir_fast_strpos(_27$$20, uri, &_26$$20, 0 ); if (!ZEPHIR_IS_FALSE_IDENTICAL(_27$$20)) { ZEPHIR_INIT_VAR(_28$$21); ZEPHIR_CONCAT_SV(_28$$21, "&", queryString); zephir_concat_self(&uri, _28$$21 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(_29$$22); ZEPHIR_CONCAT_SV(_29$$22, "?", queryString); zephir_concat_self(&uri, _29$$22 TSRMLS_CC); } } } RETVAL_ZVAL(uri, 1, 0); RETURN_MM(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code>print_r($connection->describeColumns("posts")); ?></code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Oracle, describeColumns) { zephir_fcall_cache_entry *_11 = NULL; HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns, *oldColumn = NULL, *field = NULL, *definition = NULL, *columnSize = NULL, *columnPrecision = NULL, *columnScale = NULL, *columnType = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_9, *_10; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(table_param) == IS_STRING)) { zephir_get_strval(table, table_param); } else { ZEPHIR_INIT_VAR(table); ZVAL_EMPTY_STRING(table); } if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(columns); array_init(columns); ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/oracle.zep", 203); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnSize); zephir_array_fetch_long(&columnSize, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/oracle.zep", 102 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnPrecision); zephir_array_fetch_long(&columnPrecision, field, 3, PH_NOISY, "phalcon/db/adapter/pdo/oracle.zep", 103 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnScale); zephir_array_fetch_long(&columnScale, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/oracle.zep", 104 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/oracle.zep", 105 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("NUMBER"), "phalcon/db/adapter/pdo/oracle.zep", 112)) { ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 3); zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &columnPrecision, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("scale"), &columnScale, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 32); zephir_array_update_string(&definition, SL("bindType"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("INTEGER"), "phalcon/db/adapter/pdo/oracle.zep", 121)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &columnPrecision, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("VARCHAR2"), "phalcon/db/adapter/pdo/oracle.zep", 129)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &columnSize, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("FLOAT"), "phalcon/db/adapter/pdo/oracle.zep", 135)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 7); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &columnSize, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("scale"), &columnScale, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("TIMESTAMP"), "phalcon/db/adapter/pdo/oracle.zep", 144)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("RAW"), "phalcon/db/adapter/pdo/oracle.zep", 149)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("BLOB"), "phalcon/db/adapter/pdo/oracle.zep", 154)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("CLOB"), "phalcon/db/adapter/pdo/oracle.zep", 159)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("CHAR"), "phalcon/db/adapter/pdo/oracle.zep", 164)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("size"), &columnSize, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_9, field, 6, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/oracle.zep", 183 TSRMLS_CC); if (ZEPHIR_IS_STRING(_9, "P")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/oracle.zep", 190 TSRMLS_CC); if (ZEPHIR_IS_STRING(_10, "N")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/oracle.zep", 194 TSRMLS_CC); ZEPHIR_INIT_NVAR(_8); object_init_ex(_8, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _8, "__construct", &_11, 138, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _8, PH_SEPARATE, "phalcon/db/adapter/pdo/oracle.zep", 199); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Extracts a slice from a string/array/traversable object value */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { zend_bool _1$$5; zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; int start, ZEPHIR_LAST_CALL_STATUS, position = 0; zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &value, &start_param, &end); if (!start_param) { start = 0; } else { start = zephir_get_intval(start_param); } if (!end) { ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(end); } if (Z_TYPE_P(value) == IS_OBJECT) { if (Z_TYPE_P(end) == IS_NULL) { ZEPHIR_INIT_NVAR(end); ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); } position = 0; ZEPHIR_INIT_VAR(slice); array_init(slice); ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); zephir_check_call_status(); while (1) { ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_0$$3))) { break; } _1$$5 = position >= start; if (_1$$5) { _1$$5 = ZEPHIR_GE_LONG(end, position); } if (_1$$5) { ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); zephir_check_call_status(); zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 231); } ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); zephir_check_call_status(); position++; } RETURN_CCTOR(slice); } ZEPHIR_INIT_VAR(length); if (Z_TYPE_P(end) != IS_NULL) { ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); } else { ZVAL_NULL(length); } if (Z_TYPE_P(value) == IS_ARRAY) { ZEPHIR_SINIT_VAR(_5$$9); ZVAL_LONG(&_5$$9, start); ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 374, value, &_5$$9, length); zephir_check_call_status(); RETURN_MM(); } if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { if (Z_TYPE_P(length) != IS_NULL) { ZEPHIR_SINIT_VAR(_6$$11); ZVAL_LONG(&_6$$11, start); ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 375, value, &_6$$11, length); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_VAR(_8$$10); ZVAL_LONG(&_8$$10, start); ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 375, value, &_8$$10); zephir_check_call_status(); RETURN_MM(); } if (Z_TYPE_P(length) != IS_NULL) { ZEPHIR_SINIT_VAR(_9$$12); ZVAL_LONG(&_9$$12, start); zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); RETURN_MM(); } ZEPHIR_SINIT_VAR(_10); ZVAL_LONG(&_10, start); zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); RETURN_MM(); }
/** * Phalcon\Mvc\Model\MetaData\Redis constructor * * @param array options */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, __construct) { int ZEPHIR_LAST_CALL_STATUS; zval *_2; zval *options = NULL, *ttl, *_0 = NULL, *_1, *_3, *_4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &options); if (!options) { ZEPHIR_CPY_WRT(options, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(options); } if (Z_TYPE_P(options) != IS_ARRAY) { ZEPHIR_INIT_NVAR(options); array_init(options); } if (!(zephir_array_isset_string(options, SS("host")))) { ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "127.0.0.1", 1); zephir_array_update_string(&options, SL("host"), &_0, PH_COPY | PH_SEPARATE); } if (!(zephir_array_isset_string(options, SS("port")))) { ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, 6379); zephir_array_update_string(&options, SL("port"), &_0, PH_COPY | PH_SEPARATE); } if (!(zephir_array_isset_string(options, SS("persistent")))) { ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, 0); zephir_array_update_string(&options, SL("persistent"), &_0, PH_COPY | PH_SEPARATE); } if (!(zephir_array_isset_string(options, SS("statsKey")))) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "_PHCM_MM", 1); zephir_array_update_string(&options, SL("statsKey"), &_0, PH_COPY | PH_SEPARATE); } if (zephir_array_isset_string_fetch(&ttl, options, SS("lifetime"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_ttl"), ttl TSRMLS_CC); } ZEPHIR_INIT_NVAR(_0); object_init_ex(_0, phalcon_cache_backend_redis_ce); ZEPHIR_INIT_VAR(_1); object_init_ex(_1, phalcon_cache_frontend_data_ce); ZEPHIR_INIT_VAR(_2); zephir_create_array(_2, 1, 0 TSRMLS_CC); ZEPHIR_OBS_VAR(_3); zephir_read_property_this(&_3, this_ptr, SL("_ttl"), PH_NOISY_CC); zephir_array_update_string(&_2, SL("lifetime"), &_3, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 312, _2); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 316, _1, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_redis"), _0 TSRMLS_CC); ZEPHIR_INIT_VAR(_4); array_init(_4); zephir_update_property_this(this_ptr, SL("_metaData"), _4 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Sets a cookie to be sent at the end of the request * This method overrides any cookie set before with the same name */ PHP_METHOD(Phalcon_Http_Response_Cookies, set) { zval *_3; zend_bool secure, httpOnly; int expire, ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *value = NULL, *expire_param = NULL, *path_param = NULL, *secure_param = NULL, *domain_param = NULL, *httpOnly_param = NULL, *cookie = NULL, *encryption, *dependencyInjector, *response = NULL, *_0, *_1, *_2 = NULL, *_4 = NULL, *_5; zval *name = NULL, *path = NULL, *domain = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 6, &name_param, &value, &expire_param, &path_param, &secure_param, &domain_param, &httpOnly_param); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } if (!value) { value = ZEPHIR_GLOBAL(global_null); } if (!expire_param) { expire = 0; } else { expire = zephir_get_intval(expire_param); } if (!path_param) { ZEPHIR_INIT_VAR(path); ZVAL_STRING(path, "/", 1); } else { zephir_get_strval(path, path_param); } if (!secure_param) { secure = 0; } else { secure = zephir_get_boolval(secure_param); } if (!domain_param) { ZEPHIR_INIT_VAR(domain); ZVAL_EMPTY_STRING(domain); } else { if (unlikely(Z_TYPE_P(domain_param) != IS_STRING && Z_TYPE_P(domain_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'domain' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(domain_param) == IS_STRING)) { zephir_get_strval(domain, domain_param); } else { ZEPHIR_INIT_VAR(domain); ZVAL_EMPTY_STRING(domain); } } if (!httpOnly_param) { httpOnly = 0; } else { httpOnly = zephir_get_boolval(httpOnly_param); } ZEPHIR_OBS_VAR(encryption); zephir_read_property_this(&encryption, this_ptr, SL("_useEncryption"), PH_NOISY_CC); ZEPHIR_OBS_VAR(cookie); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_cookies"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&cookie, _0, name, 0 TSRMLS_CC))) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); zephir_create_array(_3, 7, 0 TSRMLS_CC); zephir_array_fast_append(_3, name); zephir_array_fast_append(_3, value); ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, expire); zephir_array_fast_append(_3, _4); zephir_array_fast_append(_3, path); ZEPHIR_INIT_NVAR(_4); ZVAL_BOOL(_4, secure); zephir_array_fast_append(_3, _4); zephir_array_fast_append(_3, domain); ZEPHIR_INIT_NVAR(_4); ZVAL_BOOL(_4, httpOnly); zephir_array_fast_append(_3, _4); ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "Phalcon\\Http\\Cookie", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_2, _1, "get", NULL, 0, _4, _3); zephir_check_temp_parameter(_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(cookie, _2); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, cookie, "setdi", NULL, 0, _5); zephir_check_call_status(); if (zephir_is_true(encryption)) { ZEPHIR_CALL_METHOD(NULL, cookie, "useencryption", NULL, 0, encryption); zephir_check_call_status(); } zephir_update_property_array(this_ptr, SL("_cookies"), name, cookie TSRMLS_CC); } else { ZEPHIR_CALL_METHOD(NULL, cookie, "setvalue", NULL, 0, value); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, expire); ZEPHIR_CALL_METHOD(NULL, cookie, "setexpiration", NULL, 0, _4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, cookie, "setpath", NULL, 0, path); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, cookie, "setsecure", NULL, 0, (secure ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, cookie, "setdomain", NULL, 0, domain); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, cookie, "sethttponly", NULL, 0, (httpOnly ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_registered"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { ZEPHIR_OBS_VAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_http_cookie_exception_ce, "A dependency injection object is required to access the 'response' service", "phalcon/http/response/cookies.zep", 130); return; } ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "response", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&response, dependencyInjector, "getshared", NULL, 0, _4); zephir_check_temp_parameter(_4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, response, "setcookies", NULL, 0, this_ptr); zephir_check_call_status(); } RETURN_THIS(); }
/** * Stores cached content into the file backend and stops the frontend * * @param int|string keyName * @param string content * @param int lifetime * @param boolean stopBuffer */ PHP_METHOD(Phalcon_Cache_Backend_File, save) { zephir_nts_static zephir_fcall_cache_entry *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool stopBuffer; zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastKey = NULL, *frontend, *cacheDir, *isBuffering = NULL, *cacheFile, *cachedContent = NULL, *preparedContent = NULL, *status = NULL, *_0, *_1 = NULL, *_2, *_3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!content) { content = ZEPHIR_GLOBAL(global_null); } if (!lifetime) { lifetime = ZEPHIR_GLOBAL(global_null); } if (!stopBuffer_param) { stopBuffer = 1; } else { stopBuffer = zephir_get_boolval(stopBuffer_param); } if (!(zephir_is_true(keyName))) { ZEPHIR_OBS_VAR(lastKey); zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC); } else { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkey", NULL, keyName); zephir_check_call_status(); ZEPHIR_INIT_NVAR(lastKey); ZEPHIR_CONCAT_VV(lastKey, _0, _1); } if (!(zephir_is_true(lastKey))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/file.zep", 186); return; } ZEPHIR_OBS_VAR(frontend); zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); ZEPHIR_OBS_VAR(cacheDir); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (!(zephir_array_isset_string_fetch(&cacheDir, _0, SS("cacheDir"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/file.zep", 192); return; } ZEPHIR_INIT_VAR(cacheFile); ZEPHIR_CONCAT_VV(cacheFile, cacheDir, lastKey); if (!(zephir_is_true(content))) { ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(cachedContent, content); } ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, cachedContent); zephir_check_call_status(); if (!(zephir_is_numeric(cachedContent))) { ZEPHIR_INIT_VAR(status); zephir_file_put_contents(status, cacheFile, preparedContent TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(status); zephir_file_put_contents(status, cacheFile, cachedContent TSRMLS_CC); } if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { ZEPHIR_INIT_VAR(_2); object_init_ex(_2, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_SVS(_3, "Cache file ", cacheFile, " could not be written"); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", &_4, _3); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/cache/backend/file.zep", 215 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL); zephir_check_call_status(); if (stopBuffer == 1) { ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL); zephir_check_call_status(); } if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) { zend_print_zval(cachedContent, 0); } zephir_update_property_this(this_ptr, SL("_started"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Initialize the metadata for certain table */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, _initialize) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *model, *key, *table, *schema, *strategy = NULL, *className = NULL, *metaData = NULL, *data = NULL, *modelMetadata = NULL, *modelColumnMap = NULL, *dependencyInjector = NULL, *keyName = NULL, *prefixKey = NULL, *_2, *_0$$8, *_1$$8; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &model, &key, &table, &schema); ZEPHIR_INIT_VAR(strategy); ZVAL_NULL(strategy); ZEPHIR_INIT_VAR(className); zephir_get_class(className, model, 0 TSRMLS_CC); if (Z_TYPE_P(key) != IS_NULL) { ZEPHIR_OBS_VAR(metaData); zephir_read_property_this(&metaData, this_ptr, SL("_metaData"), PH_NOISY_CC); if (!(zephir_array_isset(metaData, key))) { ZEPHIR_INIT_VAR(prefixKey); ZEPHIR_CONCAT_SV(prefixKey, "meta-", key); ZEPHIR_CALL_METHOD(&data, this_ptr, "read", NULL, 0, prefixKey); zephir_check_call_status(); if (Z_TYPE_P(data) != IS_NULL) { zephir_update_property_array(this_ptr, SL("_metaData"), key, data TSRMLS_CC); } else { if ((zephir_method_exists_ex(model, SS("metadata") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&modelMetadata, model, "metadata", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(modelMetadata) != IS_ARRAY) { ZEPHIR_INIT_VAR(_0$$8); object_init_ex(_0$$8, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_1$$8); ZEPHIR_CONCAT_SV(_1$$8, "Invalid meta-data for model ", className); ZEPHIR_CALL_METHOD(NULL, _0$$8, "__construct", NULL, 9, _1$$8); zephir_check_call_status(); zephir_throw_exception_debug(_0$$8, "phalcon/mvc/model/metadata.zep", 122 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_OBS_VAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&strategy, this_ptr, "getstrategy", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&modelMetadata, strategy, "getmetadata", NULL, 0, model, dependencyInjector); zephir_check_call_status(); } zephir_update_property_array(this_ptr, SL("_metaData"), key, modelMetadata TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, prefixKey, modelMetadata); zephir_check_call_status(); } } } if (!(ZEPHIR_GLOBAL(orm).column_renaming)) { RETURN_MM_NULL(); } ZEPHIR_INIT_VAR(keyName); zephir_fast_strtolower(keyName, className); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_columnMap"), PH_NOISY_CC); if (zephir_array_isset(_2, keyName)) { RETURN_MM_NULL(); } ZEPHIR_INIT_NVAR(prefixKey); ZEPHIR_CONCAT_SV(prefixKey, "map-", keyName); ZEPHIR_CALL_METHOD(&data, this_ptr, "read", NULL, 0, prefixKey); zephir_check_call_status(); if (Z_TYPE_P(data) != IS_NULL) { zephir_update_property_array(this_ptr, SL("_columnMap"), keyName, data TSRMLS_CC); RETURN_MM_NULL(); } if (Z_TYPE_P(strategy) != IS_OBJECT) { ZEPHIR_OBS_NVAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&strategy, this_ptr, "getstrategy", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&modelColumnMap, strategy, "getcolumnmaps", NULL, 0, model, dependencyInjector); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("_columnMap"), keyName, modelColumnMap TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, prefixKey, modelColumnMap); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Phalcon\Config\Adapter\Ini constructor */ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct) { zephir_fcall_cache_entry *_10 = NULL, *_12 = NULL; HashTable *_4, *_7; HashPosition _3, _6; int ZEPHIR_LAST_CALL_STATUS; zval *filePath_param = NULL, *iniConfig = NULL, *_0 = NULL, *_1, *_2, *config, *section = NULL, *sections = NULL, *directives = NULL, *path = NULL, *lastValue = NULL, **_5, **_8, *_9 = NULL, _11 = zval_used_for_init; zval *filePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &filePath_param); if (unlikely(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) { zephir_get_strval(filePath, filePath_param); } else { ZEPHIR_INIT_VAR(filePath); ZVAL_EMPTY_STRING(filePath); } ZEPHIR_CALL_FUNCTION(&iniConfig, "parse_ini_file", NULL, 61, filePath, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(iniConfig)) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, phalcon_config_exception_ce); ZEPHIR_INIT_VAR(_1); zephir_basename(_1, filePath TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_SVS(_2, "Configuration file ", _1, " can't be loaded"); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 2, _2); zephir_check_call_status(); zephir_throw_exception_debug(_0, "phalcon/config/adapter/ini.zep", 67 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(config); array_init(config); zephir_is_iterable(iniConfig, &_4, &_3, 0, 0, "phalcon/config/adapter/ini.zep", 82); for ( ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(section, _4, _3); ZEPHIR_GET_HVALUE(directives, _5); ZEPHIR_INIT_NVAR(sections); array_init(sections); zephir_is_iterable(directives, &_7, &_6, 0, 0, "phalcon/config/adapter/ini.zep", 79); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HMKEY(path, _7, _6); ZEPHIR_GET_HVALUE(lastValue, _8); ZEPHIR_CALL_METHOD(&_9, this_ptr, "_parseinistring", &_10, 0, path, lastValue); zephir_check_call_status(); zephir_array_append(§ions, _9, PH_SEPARATE, "phalcon/config/adapter/ini.zep", 77); } ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_11); ZVAL_STRING(&_11, "array_merge_recursive", 0); ZEPHIR_CALL_USER_FUNC_ARRAY(_0, &_11, sections); zephir_check_call_status(); zephir_array_update_zval(&config, section, &_0, PH_COPY | PH_SEPARATE); } ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_ini_ce, this_ptr, "__construct", &_12, 58, config); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Clears every element in the form to its default value * * @param array fields */ PHP_METHOD(Phalcon_Forms_Form, clear) { HashTable *_1$$5, *_4$$10; HashPosition _0$$5, _3$$10; int ZEPHIR_LAST_CALL_STATUS; zval *fields = NULL, *elements = NULL, *element = NULL, *data = NULL, *field = NULL, **_2$$5, **_5$$10, *_6$$13 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &fields); if (!fields) { fields = ZEPHIR_GLOBAL(global_null); } ZEPHIR_OBS_VAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); if (Z_TYPE_P(fields) == IS_NULL) { ZEPHIR_INIT_NVAR(data); array_init(data); } else { if (Z_TYPE_P(fields) == IS_ARRAY) { zephir_is_iterable(fields, &_1$$5, &_0$$5, 0, 0, "phalcon/forms/form.zep", 652); for ( ; zend_hash_get_current_data_ex(_1$$5, (void**) &_2$$5, &_0$$5) == SUCCESS ; zend_hash_move_forward_ex(_1$$5, &_0$$5) ) { ZEPHIR_GET_HVALUE(field, _2$$5); if (zephir_array_isset(data, field)) { zephir_array_unset(&data, field, PH_SEPARATE); } } } else { if (zephir_array_isset(data, field)) { zephir_array_unset(&data, field, PH_SEPARATE); } } } zephir_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC); ZEPHIR_OBS_VAR(elements); zephir_read_property_this(&elements, this_ptr, SL("_elements"), PH_NOISY_CC); if (Z_TYPE_P(elements) == IS_ARRAY) { zephir_is_iterable(elements, &_4$$10, &_3$$10, 0, 0, "phalcon/forms/form.zep", 672); for ( ; zend_hash_get_current_data_ex(_4$$10, (void**) &_5$$10, &_3$$10) == SUCCESS ; zend_hash_move_forward_ex(_4$$10, &_3$$10) ) { ZEPHIR_GET_HVALUE(element, _5$$10); if (Z_TYPE_P(fields) != IS_ARRAY) { ZEPHIR_CALL_METHOD(NULL, element, "clear", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&_6$$13, element, "getname", NULL, 0); zephir_check_call_status(); if (zephir_fast_in_array(_6$$13, fields TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, element, "clear", NULL, 0); zephir_check_call_status(); } } } } RETURN_THIS(); }
/** * Phalcon\Session\Adapter\Redis constructor */ PHP_METHOD(Phalcon_Session_Adapter_Redis, __construct) { zephir_fcall_cache_entry *_13 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *options_param = NULL, *lifetime = NULL, *_2, *_3, *_5, *_7 = NULL, *_0$$3, *_1$$4; zval *options = NULL, *_4, *_6, *_8, *_9, *_10, *_11, *_12; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &options_param); if (!options_param) { ZEPHIR_INIT_VAR(options); array_init(options); } else { zephir_get_arrval(options, options_param); } if (!(zephir_array_isset_string(options, SS("host")))) { ZEPHIR_INIT_VAR(_0$$3); ZVAL_STRING(_0$$3, "127.0.0.1", 1); zephir_array_update_string(&options, SL("host"), &_0$$3, PH_COPY | PH_SEPARATE); } if (!(zephir_array_isset_string(options, SS("port")))) { ZEPHIR_INIT_VAR(_1$$4); ZVAL_LONG(_1$$4, 6379); zephir_array_update_string(&options, SL("port"), &_1$$4, PH_COPY | PH_SEPARATE); } if (!(zephir_array_isset_string(options, SS("persistent")))) { zephir_array_update_string(&options, SL("persistent"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_VAR(lifetime); if (zephir_array_isset_string_fetch(&lifetime, options, SS("lifetime"), 0 TSRMLS_CC)) { zephir_update_property_this(getThis(), SL("_lifetime"), lifetime TSRMLS_CC); } ZEPHIR_INIT_VAR(_2); object_init_ex(_2, phalcon_cache_backend_redis_ce); ZEPHIR_INIT_VAR(_3); object_init_ex(_3, phalcon_cache_frontend_none_ce); if (zephir_has_constructor(_3 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_4); zephir_create_array(_4, 1, 0 TSRMLS_CC); ZEPHIR_OBS_VAR(_5); zephir_read_property_this(&_5, this_ptr, SL("_lifetime"), PH_NOISY_CC); zephir_array_update_string(&_4, SL("lifetime"), &_5, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, _3, "__construct", NULL, 0, _4); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 354, _3, options); zephir_check_call_status(); zephir_update_property_this(getThis(), SL("_redis"), _2 TSRMLS_CC); ZEPHIR_INIT_VAR(_6); zephir_create_array(_6, 2, 0 TSRMLS_CC); zephir_array_fast_append(_6, this_ptr); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "open", 1); zephir_array_fast_append(_6, _7); ZEPHIR_INIT_VAR(_8); zephir_create_array(_8, 2, 0 TSRMLS_CC); zephir_array_fast_append(_8, this_ptr); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "close", 1); zephir_array_fast_append(_8, _7); ZEPHIR_INIT_VAR(_9); zephir_create_array(_9, 2, 0 TSRMLS_CC); zephir_array_fast_append(_9, this_ptr); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "read", 1); zephir_array_fast_append(_9, _7); ZEPHIR_INIT_VAR(_10); zephir_create_array(_10, 2, 0 TSRMLS_CC); zephir_array_fast_append(_10, this_ptr); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "write", 1); zephir_array_fast_append(_10, _7); ZEPHIR_INIT_VAR(_11); zephir_create_array(_11, 2, 0 TSRMLS_CC); zephir_array_fast_append(_11, this_ptr); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "destroy", 1); zephir_array_fast_append(_11, _7); ZEPHIR_INIT_VAR(_12); zephir_create_array(_12, 2, 0 TSRMLS_CC); zephir_array_fast_append(_12, this_ptr); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "gc", 1); zephir_array_fast_append(_12, _7); ZEPHIR_CALL_FUNCTION(NULL, "session_set_save_handler", NULL, 450, _6, _8, _9, _10, _11, _12); zephir_check_call_status(); ZEPHIR_CALL_PARENT(NULL, phalcon_session_adapter_redis_ce, getThis(), "__construct", &_13, 451, options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Binds data to the entity * * @param array data * @param object entity * @param array whitelist */ PHP_METHOD(Phalcon_Forms_Form, bind) { HashTable *_2; HashPosition _1; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *entity, *whitelist = NULL, *filter = NULL, *key = NULL, *value = NULL, *element = NULL, *filters = NULL, *dependencyInjector = NULL, *filteredValue = NULL, *method = NULL, *_0, **_3, *_4$$4, *_8$$4 = NULL, *_6$$9 = NULL, *_7$$9 = NULL; zval *data = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &data_param, &entity, &whitelist); data = data_param; ZEPHIR_SEPARATE_PARAM(entity); if (!whitelist) { whitelist = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(_0)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "There are no elements in the form", "phalcon/forms/form.zep", 189); return; } ZEPHIR_INIT_VAR(filter); ZVAL_NULL(filter); zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/forms/form.zep", 246); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(key, _2, _1); ZEPHIR_GET_HVALUE(value, _3); ZEPHIR_OBS_NVAR(element); _4$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&element, _4$$4, key, 0 TSRMLS_CC))) { continue; } if (Z_TYPE_P(whitelist) == IS_ARRAY) { if (!(zephir_fast_in_array(key, whitelist TSRMLS_CC))) { continue; } } ZEPHIR_CALL_METHOD(&filters, element, "getfilters", NULL, 0); zephir_check_call_status(); if (zephir_is_true(filters)) { if (Z_TYPE_P(filter) != IS_OBJECT) { ZEPHIR_CALL_METHOD(&dependencyInjector, this_ptr, "getdi", &_5, 0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_7$$9); ZVAL_STRING(_7$$9, "filter", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_6$$9, dependencyInjector, "getshared", NULL, 0, _7$$9); zephir_check_temp_parameter(_7$$9); zephir_check_call_status(); ZEPHIR_CPY_WRT(filter, _6$$9); } ZEPHIR_CALL_METHOD(&filteredValue, filter, "sanitize", NULL, 0, value, filters); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(filteredValue, value); } ZEPHIR_INIT_NVAR(_8$$4); zephir_camelize(_8$$4, key, NULL ); ZEPHIR_INIT_NVAR(method); ZEPHIR_CONCAT_SV(method, "set", _8$$4); if ((zephir_method_exists(entity, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, method, NULL, 0, filteredValue); zephir_check_call_status(); continue; } zephir_update_property_zval_zval(entity, key, filteredValue TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC); RETURN_THIS(); }
PHP_METHOD(Test_Globals, getDefaultGlobals3) { RETURN_DOUBLE(ZEPHIR_GLOBAL(test).my_setting_3); }
/** * Validates the form * * @param array data * @param object entity */ PHP_METHOD(Phalcon_Forms_Form, isValid) { zend_object_iterator *_17$$15; HashTable *_8, *_12$$11; HashPosition _7, _11$$11; zend_bool validationStatus = 0, _5, _10$$11; zephir_fcall_cache_entry *_1 = NULL, *_14 = NULL, *_15 = NULL, *_20 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *data = NULL, *entity = NULL, *messages = NULL, *element = NULL, *validators = NULL, *name = NULL, *filters = NULL, *validator = NULL, *validation = NULL, *elementMessage = NULL, *_0, *_6, **_9, *_16 = NULL, *_2$$6, *_3$$7, *_4$$8 = NULL, **_13$$11, *_18$$16 = NULL, *_19$$16 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, &data, &entity); if (!data) { ZEPHIR_CPY_WRT(data, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(data); } if (!entity) { entity = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(_0)) { RETURN_MM_BOOL(1); } if (Z_TYPE_P(data) != IS_ARRAY) { ZEPHIR_OBS_NVAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); } if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", &_1, 0, data, entity); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(_2$$6); zephir_read_property_this(&_2$$6, this_ptr, SL("_entity"), PH_NOISY_CC); if (Z_TYPE_P(_2$$6) == IS_OBJECT) { _3$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_entity"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", &_1, 0, data, _3$$7); zephir_check_call_status(); } } if ((zephir_method_exists_ex(this_ptr, SS("beforevalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_4$$8, this_ptr, "beforevalidation", NULL, 0, data, entity); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_4$$8)) { RETURN_MM_BOOL(0); } } validationStatus = 1; ZEPHIR_CALL_METHOD(&validation, this_ptr, "getvalidation", NULL, 0); zephir_check_call_status(); _5 = Z_TYPE_P(validation) != IS_OBJECT; if (!(_5)) { _5 = !((zephir_instance_of_ev(validation, phalcon_validationinterface_ce TSRMLS_CC))); } if (_5) { ZEPHIR_INIT_NVAR(validation); object_init_ex(validation, phalcon_validation_ce); ZEPHIR_CALL_METHOD(NULL, validation, "__construct", NULL, 216); zephir_check_call_status(); } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); zephir_is_iterable(_6, &_8, &_7, 0, 0, "phalcon/forms/form.zep", 338); for ( ; zend_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zend_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(element, _9); ZEPHIR_CALL_METHOD(&validators, element, "getvalidators", NULL, 0); zephir_check_call_status(); _10$$11 = Z_TYPE_P(validators) != IS_ARRAY; if (!(_10$$11)) { _10$$11 = zephir_fast_count_int(validators TSRMLS_CC) == 0; } if (_10$$11) { continue; } ZEPHIR_CALL_METHOD(&name, element, "getname", NULL, 0); zephir_check_call_status(); zephir_is_iterable(validators, &_12$$11, &_11$$11, 0, 0, "phalcon/forms/form.zep", 325); for ( ; zend_hash_get_current_data_ex(_12$$11, (void**) &_13$$11, &_11$$11) == SUCCESS ; zend_hash_move_forward_ex(_12$$11, &_11$$11) ) { ZEPHIR_GET_HVALUE(validator, _13$$11); ZEPHIR_CALL_METHOD(NULL, validation, "add", &_14, 217, name, validator); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&filters, element, "getfilters", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(filters) == IS_ARRAY) { ZEPHIR_CALL_METHOD(NULL, validation, "setfilters", &_15, 218, name, filters); zephir_check_call_status(); } } ZEPHIR_CALL_METHOD(&messages, validation, "validate", NULL, 219, data, entity); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_16, messages, "count", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_16)) { _17$$15 = zephir_get_iterator(messages TSRMLS_CC); _17$$15->funcs->rewind(_17$$15 TSRMLS_CC); for (;_17$$15->funcs->valid(_17$$15 TSRMLS_CC) == SUCCESS && !EG(exception); _17$$15->funcs->move_forward(_17$$15 TSRMLS_CC)) { { zval **ZEPHIR_TMP_ITERATOR_PTR; _17$$15->funcs->get_current_data(_17$$15, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); ZEPHIR_CPY_WRT(elementMessage, (*ZEPHIR_TMP_ITERATOR_PTR)); } ZEPHIR_CALL_METHOD(&_19$$16, elementMessage, "getfield", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_18$$16, this_ptr, "get", &_20, 0, _19$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _18$$16, "appendmessage", NULL, 0, elementMessage); zephir_check_call_status(); } _17$$15->funcs->dtor(_17$$15 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, messages, "rewind", NULL, 0); zephir_check_call_status(); validationStatus = 0; } if (!(validationStatus)) { zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); } if ((zephir_method_exists_ex(this_ptr, SS("aftervalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "aftervalidation", NULL, 0, messages); zephir_check_call_status(); } RETURN_MM_BOOL(validationStatus); }
PHP_METHOD(Test_Globals, getDefaultGlobals5) { RETURN_LONG(ZEPHIR_GLOBAL(my_setting_2)); }
/** * Lists table indexes * * <code> * print_r($connection->describeIndexes('robots_parts')); * </code> * * @param string table * @param string schema * @return \Phalcon\Db\IndexInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeIndexes) { HashTable *_5, *_16; HashPosition _4, _15; zephir_fcall_cache_entry *_21 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema = NULL, *indexes = NULL, *index = NULL, *keyName = NULL, *indexType = NULL, *indexObjects = NULL, *columns = NULL, *name = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, **_17, *_7$$4 = NULL, *_8$$3, *_10$$3, *_11$$3, *_9$$6, *_12$$7 = NULL, *_13$$8 = NULL, *_14$$9 = NULL, *_18$$11 = NULL, *_19$$11, *_20$$11; zval *table = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema); if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(table_param) == IS_STRING)) { zephir_get_strval(table, table_param); } else { ZEPHIR_INIT_VAR(table); ZVAL_EMPTY_STRING(table); } if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(indexes); array_init(indexes); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describeindexes", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 2); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 392); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(index, _6); zephir_array_fetch_string(&keyName, index, SL("Key_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 365 TSRMLS_CC); zephir_array_fetch_string(&indexType, index, SL("Index_type"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 366 TSRMLS_CC); if (!(zephir_array_isset(indexes, keyName))) { ZEPHIR_INIT_NVAR(_7$$4); array_init(_7$$4); zephir_array_update_zval(&indexes, keyName, &_7$$4, PH_COPY | PH_SEPARATE); } zephir_array_fetch(&_8$$3, indexes, keyName, PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 372 TSRMLS_CC); if (!(zephir_array_isset_string(_8$$3, SS("columns")))) { ZEPHIR_INIT_NVAR(columns); array_init(columns); } else { zephir_array_fetch(&_9$$6, indexes, keyName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 375 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9$$6, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 375 TSRMLS_CC); } zephir_array_fetch_string(&_10$$3, index, SL("Column_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 378 TSRMLS_CC); zephir_array_append(&columns, _10$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 378); zephir_array_update_multi(&indexes, &columns TSRMLS_CC, SL("zs"), 3, keyName, SL("columns")); zephir_array_fetch_string(&_11$$3, index, SL("Non_unique"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 385 TSRMLS_CC); if (ZEPHIR_IS_STRING(keyName, "PRIMARY")) { ZEPHIR_INIT_NVAR(_12$$7); ZVAL_STRING(_12$$7, "PRIMARY", 1); zephir_array_update_multi(&indexes, &_12$$7 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else if (ZEPHIR_IS_STRING(indexType, "FULLTEXT")) { ZEPHIR_INIT_NVAR(_13$$8); ZVAL_STRING(_13$$8, "FULLTEXT", 1); zephir_array_update_multi(&indexes, &_13$$8 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else if (ZEPHIR_IS_LONG(_11$$3, 0)) { ZEPHIR_INIT_NVAR(_14$$9); ZVAL_STRING(_14$$9, "UNIQUE", 1); zephir_array_update_multi(&indexes, &_14$$9 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else { zephir_array_update_multi(&indexes, &ZEPHIR_GLOBAL(global_null) TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } } ZEPHIR_INIT_VAR(indexObjects); array_init(indexObjects); zephir_is_iterable(indexes, &_16, &_15, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 397); for ( ; zephir_hash_get_current_data_ex(_16, (void**) &_17, &_15) == SUCCESS ; zephir_hash_move_forward_ex(_16, &_15) ) { ZEPHIR_GET_HMKEY(name, _16, _15); ZEPHIR_GET_HVALUE(index, _17); ZEPHIR_INIT_NVAR(_18$$11); object_init_ex(_18$$11, phalcon_db_index_ce); zephir_array_fetch_string(&_19$$11, index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 394 TSRMLS_CC); zephir_array_fetch_string(&_20$$11, index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 394 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, _18$$11, "__construct", &_21, 22, name, _19$$11, _20$$11); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_18$$11, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }