/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zend_bool _40$$24; HashTable *_18$$14; HashPosition _17$$14; zval *_1, *_26$$16 = NULL; zephir_fcall_cache_entry *_21 = NULL, *_47 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *className = NULL, *prepareInternalClass = NULL, *preparedFunctionName = NULL, *html = NULL, *classReflection = NULL, *prepareUriClass = NULL, *functionName = NULL, *functionReflection = NULL, *traceArgs = NULL, *arguments = NULL, *argument = NULL, *filez = NULL, *line = NULL, *showFiles = NULL, *lines = NULL, *numberLines = NULL, *showFileFragment = NULL, *beforeLine = NULL, *afterLine = NULL, *lastLine = NULL, *linePosition = NULL, *currentLine = NULL, *classNameWithLink = NULL, *functionNameWithLink = NULL, _0, *_16, *_2$$3, *_3$$3, _4$$3, *_11$$3, *_12$$3, _5$$4, _6$$4, *_7$$5 = NULL, *_8$$6, _9$$6, _10$$6, *_13$$10 = NULL, _14$$11, _15$$11, **_19$$14, *_23$$14, *_24$$14, *_20$$15 = NULL, *_22$$15 = NULL, *_25$$16, *_27$$16, _28$$18, _29$$18, *_30$$18, _31$$23, *_32$$23, *_33$$26 = NULL, *_34$$26 = NULL, *_35$$26 = NULL, _36$$26 = zval_used_for_init, *_37$$27 = NULL, _38$$27 = zval_used_for_init, _39$$27 = zval_used_for_init, *_41$$29 = NULL, _42$$29 = zval_used_for_init, _43$$29 = zval_used_for_init, _44$$29 = zval_used_for_init, _45$$29 = zval_used_for_init, *_46$$29 = NULL; int n, ZEPHIR_LAST_CALL_STATUS, firstLine = 0, i = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, trace, SS("class"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "/^Phalcon/", 0); zephir_preg_match(_3$$3, &_4$$3, className, _2$$3, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_3$$3)) { ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "\\", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "/", 0); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, &_5$$4, &_6$$4, className TSRMLS_CC); ZEPHIR_INIT_VAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"//api.phalconphp.com/class/", prepareUriClass, ".html\">", className, "</a>"); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", NULL, 91, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7$$5, classReflection, "isinternal", NULL, 163); zephir_check_call_status(); if (zephir_is_true(_7$$5)) { ZEPHIR_INIT_VAR(_8$$6); zephir_fast_strtolower(_8$$6, className); ZEPHIR_SINIT_VAR(_9$$6); ZVAL_STRING(&_9$$6, "_", 0); ZEPHIR_SINIT_VAR(_10$$6); ZVAL_STRING(&_10$$6, "-", 0); ZEPHIR_INIT_VAR(prepareInternalClass); zephir_fast_str_replace(&prepareInternalClass, &_9$$6, &_10$$6, _8$$6 TSRMLS_CC); ZEPHIR_INIT_NVAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a>"); } else { ZEPHIR_CPY_WRT(classNameWithLink, className); } } ZEPHIR_INIT_VAR(_11$$3); ZEPHIR_CONCAT_SVS(_11$$3, "<span class=\"error-class\">", classNameWithLink, "</span>"); zephir_concat_self(&html, _11$$3 TSRMLS_CC); zephir_array_fetch_string(&_12$$3, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 386 TSRMLS_CC); zephir_concat_self(&html, _12$$3 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 392 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", NULL, 82, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$10, functionReflection, "isinternal", NULL, 164); zephir_check_call_status(); if (zephir_is_true(_13$$10)) { ZEPHIR_SINIT_VAR(_14$$11); ZVAL_STRING(&_14$$11, "_", 0); ZEPHIR_SINIT_VAR(_15$$11); ZVAL_STRING(&_15$$11, "-", 0); ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, &_14$$11, &_15$$11, functionName TSRMLS_CC); ZEPHIR_INIT_NVAR(functionNameWithLink); ZEPHIR_CONCAT_SVSVS(functionNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a>"); } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } ZEPHIR_INIT_VAR(_16); ZEPHIR_CONCAT_SVS(_16, "<span class=\"error-function\">", functionNameWithLink, "</span>"); zephir_concat_self(&html, _16 TSRMLS_CC); ZEPHIR_OBS_VAR(traceArgs); if (zephir_array_isset_string_fetch(&traceArgs, trace, SS("args"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_18$$14, &_17$$14, 0, 0, "phalcon/debug.zep", 441); for ( ; zend_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zend_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(argument, _19$$14); ZEPHIR_CALL_METHOD(&_20$$15, this_ptr, "_getvardump", &_21, 0, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$15); ZEPHIR_CONCAT_SVS(_22$$15, "<span class=\"error-parameter\">", _20$$15, "</span>"); zephir_array_append(&arguments, _22$$15, PH_SEPARATE, "phalcon/debug.zep", 435); } ZEPHIR_INIT_VAR(_23$$14); zephir_fast_join_str(_23$$14, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_VAR(_24$$14); ZEPHIR_CONCAT_SVS(_24$$14, "(", _23$$14, ")"); zephir_concat_self(&html, _24$$14 TSRMLS_CC); } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_25$$16); zephir_array_fetch_string(&_25$$16, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 449 TSRMLS_CC); zephir_get_strval(_26$$16, _25$$16); ZEPHIR_CPY_WRT(line, _26$$16); ZEPHIR_INIT_VAR(_27$$16); ZEPHIR_CONCAT_SVSVS(_27$$16, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _27$$16 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", NULL, 165, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_28$$18); ZVAL_LONG(&_28$$18, firstLine); ZEPHIR_SINIT_VAR(_29$$18); ZVAL_LONG(&_29$$18, firstLine); ZEPHIR_INIT_VAR(_30$$18); ZEPHIR_CONCAT_SVSVSVS(_30$$18, "<pre class=\"prettyprint highlight:", &_28$$18, ":", line, " linenums:", &_29$$18, "\">"); zephir_concat_self(&html, _30$$18 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_VAR(_31$$23); ZVAL_LONG(&_31$$23, firstLine); ZEPHIR_INIT_VAR(_32$$23); ZEPHIR_CONCAT_SVSVS(_32$$23, "<pre class=\"prettyprint highlight:", &_31$$23, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _32$$23 TSRMLS_CC); } i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_INIT_NVAR(linePosition); ZVAL_LONG(linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, linePosition, PH_NOISY, "phalcon/debug.zep", 522 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_33$$26); ZEPHIR_INIT_NVAR(_34$$26); ZEPHIR_INIT_NVAR(_35$$26); zephir_fast_trim(_35$$26, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_SINIT_NVAR(_36$$26); ZVAL_STRING(&_36$$26, "#\\*\\/#", 0); zephir_preg_match(_34$$26, &_36$$26, _35$$26, _33$$26, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_34$$26)) { ZEPHIR_INIT_NVAR(_37$$27); ZEPHIR_SINIT_NVAR(_38$$27); ZVAL_STRING(&_38$$27, "* /", 0); ZEPHIR_SINIT_NVAR(_39$$27); ZVAL_STRING(&_39$$27, " ", 0); zephir_fast_str_replace(&_37$$27, &_38$$27, &_39$$27, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _37$$27); } } } _40$$24 = ZEPHIR_IS_STRING(currentLine, "\n"); if (!(_40$$24)) { _40$$24 = ZEPHIR_IS_STRING(currentLine, "\r\n"); } if (_40$$24) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_41$$29); ZEPHIR_SINIT_NVAR(_42$$29); ZVAL_STRING(&_42$$29, "\t", 0); ZEPHIR_SINIT_NVAR(_43$$29); ZVAL_STRING(&_43$$29, " ", 0); zephir_fast_str_replace(&_41$$29, &_42$$29, &_43$$29, currentLine TSRMLS_CC); ZEPHIR_SINIT_NVAR(_44$$29); ZVAL_LONG(&_44$$29, 2); ZEPHIR_SINIT_NVAR(_45$$29); ZVAL_STRING(&_45$$29, "UTF-8", 0); ZEPHIR_CALL_FUNCTION(&_46$$29, "htmlentities", &_47, 158, _41$$29, &_44$$29, &_45$$29); zephir_check_call_status(); zephir_concat_self(&html, _46$$29 TSRMLS_CC); } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }
/** * Check whether a role is allowed to access an action from a resource * * <code> * //Does andres have access to the customers resource to create? * $acl->isAllowed("andres", "Products", "create"); * * //Do guests have access to any resource to edit? * $acl->isAllowed("guests", "*", "edit"); * </code> */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) { zend_bool _15$$31, _20$$33, _22$$33, _24$$33, _26$$33, _40$$40, _42$$39, _44$$41; HashTable *_5$$13, *_8$$19, *_11$$25, *_18$$30; HashPosition _4$$13, _7$$19, _10$$25, _17$$30; zephir_fcall_cache_entry *_34 = NULL, *_38 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *parameters = NULL; zval *access = NULL; zval *roleName = NULL, *resourceName = NULL, *access_param = NULL, *parameters_param = NULL, *eventsManager = NULL, *accessList = NULL, *accessKey = NULL, *haveAccess = NULL, *roleInherits = NULL, *inheritedRole = NULL, *rolesNames = NULL, *inheritedRoles = NULL, *funcAccess = NULL, *resourceObject = NULL, *roleObject = NULL, *funcList = NULL, *reflectionFunction = NULL, *reflectionParameters = NULL, *parameterNumber = NULL, *parametersForFunction = NULL, *numberOfRequiredParameters = NULL, *userParametersSizeShouldBe = NULL, *reflectionClass = NULL, *parameterToCheck = NULL, *reflectionParameter = NULL, *_0, *_1$$7 = NULL, *_2$$7, *_3$$9, **_6$$13, **_9$$19, **_12$$25, *_13$$28, *_14$$29, *_16$$31, **_19$$30, *_46$$30, *_47$$30, *_21$$33 = NULL, *_23$$33 = NULL, *_25$$33 = NULL, *_27$$33 = NULL, *_28$$33, *_29$$36 = NULL, *_30$$36 = NULL, *_31$$36, *_32$$36 = NULL, *_33$$36 = NULL, *_35$$37, *_36$$38, _37$$38, *_39$$40, *_41$$40, *_43$$39, *_45$$41; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &roleName, &resourceName, &access_param, ¶meters_param); ZEPHIR_SEPARATE_PARAM(roleName); ZEPHIR_SEPARATE_PARAM(resourceName); zephir_get_strval(access, access_param); if (!parameters_param) { ZEPHIR_INIT_VAR(parameters); array_init(parameters); } else { zephir_get_arrval(parameters, parameters_param); } ZEPHIR_INIT_VAR(haveAccess); ZVAL_NULL(haveAccess); ZEPHIR_INIT_VAR(funcAccess); ZVAL_NULL(funcAccess); ZEPHIR_INIT_VAR(resourceObject); ZVAL_NULL(resourceObject); ZEPHIR_INIT_VAR(roleObject); ZVAL_NULL(roleObject); if (Z_TYPE_P(roleName) == IS_OBJECT) { if (!(zephir_instance_of_ev(roleName, phalcon_acl_roleaware_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as roleName must implement RoleAware", "phalcon/acl/adapter/memory.zep", 545); return; } ZEPHIR_CPY_WRT(roleObject, roleName); ZEPHIR_CALL_METHOD(&roleName, roleObject, "getrolename", NULL, 0); zephir_check_call_status(); } if (Z_TYPE_P(resourceName) == IS_OBJECT) { if (!(zephir_instance_of_ev(resourceName, phalcon_acl_resourceaware_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as resourceName must implement ResourceAware", "phalcon/acl/adapter/memory.zep", 553); return; } ZEPHIR_CPY_WRT(resourceObject, resourceName); ZEPHIR_CALL_METHOD(&resourceName, resourceObject, "getresourcename", NULL, 0); zephir_check_call_status(); } zephir_update_property_this(this_ptr, SL("_activeRole"), roleName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeResource"), resourceName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeAccess"), access TSRMLS_CC); ZEPHIR_OBS_VAR(accessList); zephir_read_property_this(&accessList, this_ptr, SL("_access"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); ZEPHIR_OBS_VAR(funcList); zephir_read_property_this(&funcList, this_ptr, SL("_func"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_2$$7); ZVAL_STRING(_2$$7, "acl:beforeCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1$$7, eventsManager, "fire", NULL, 0, _2$$7, this_ptr); zephir_check_temp_parameter(_2$$7); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_1$$7)) { RETURN_MM_BOOL(0); } } ZEPHIR_OBS_VAR(rolesNames); zephir_read_property_this(&rolesNames, this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (!(zephir_array_isset(rolesNames, roleName))) { _3$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); RETURN_MM_BOOL((ZEPHIR_IS_LONG(_3$$9, 1))); } ZEPHIR_INIT_VAR(accessKey); ZEPHIR_CONCAT_VSVSV(accessKey, roleName, "!", resourceName, "!", access); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 586 TSRMLS_CC); } ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_OBS_VAR(roleInherits); zephir_read_property_this(&roleInherits, this_ptr, SL("_roleInherits"), PH_NOISY_CC); ZEPHIR_OBS_VAR(inheritedRoles); if (zephir_array_isset_fetch(&inheritedRoles, roleInherits, roleName, 0 TSRMLS_CC)) { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_5$$13, &_4$$13, 0, 0, "phalcon/acl/adapter/memory.zep", 610); for ( ; zephir_hash_get_current_data_ex(_5$$13, (void**) &_6$$13, &_4$$13) == SUCCESS ; zephir_hash_move_forward_ex(_5$$13, &_4$$13) ) { ZEPHIR_GET_HVALUE(inheritedRole, _6$$13); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVSV(accessKey, inheritedRole, "!", resourceName, "!", access); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 606 TSRMLS_CC); } ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVS(accessKey, roleName, "!", resourceName, "!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 625 TSRMLS_CC); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_8$$19, &_7$$19, 0, 0, "phalcon/acl/adapter/memory.zep", 641); for ( ; zephir_hash_get_current_data_ex(_8$$19, (void**) &_9$$19, &_7$$19) == SUCCESS ; zephir_hash_move_forward_ex(_8$$19, &_7$$19) ) { ZEPHIR_GET_HVALUE(inheritedRole, _9$$19); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVS(accessKey, inheritedRole, "!", resourceName, "!*"); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 637 TSRMLS_CC); break; } } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VS(accessKey, roleName, "!*!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 656 TSRMLS_CC); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_11$$25, &_10$$25, 0, 0, "phalcon/acl/adapter/memory.zep", 672); for ( ; zephir_hash_get_current_data_ex(_11$$25, (void**) &_12$$25, &_10$$25) == SUCCESS ; zephir_hash_move_forward_ex(_11$$25, &_10$$25) ) { ZEPHIR_GET_HVALUE(inheritedRole, _12$$25); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VS(accessKey, inheritedRole, "!*!*"); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 668 TSRMLS_CC); break; } } } } } zephir_update_property_this(this_ptr, SL("_accessGranted"), haveAccess TSRMLS_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_13$$28); ZVAL_STRING(_13$$28, "acl:afterCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _13$$28, this_ptr); zephir_check_temp_parameter(_13$$28); zephir_check_call_status(); } if (Z_TYPE_P(haveAccess) == IS_NULL) { _14$$29 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); RETURN_MM_BOOL(ZEPHIR_IS_LONG(_14$$29, 1)); } if (Z_TYPE_P(funcAccess) != IS_NULL) { ZEPHIR_INIT_VAR(reflectionFunction); object_init_ex(reflectionFunction, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflectionFunction, "__construct", NULL, 85, funcAccess); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&reflectionParameters, reflectionFunction, "getparameters", NULL, 86); zephir_check_call_status(); ZEPHIR_INIT_VAR(parameterNumber); ZVAL_LONG(parameterNumber, zephir_fast_count_int(reflectionParameters TSRMLS_CC)); if (ZEPHIR_IS_LONG_IDENTICAL(parameterNumber, 0)) { _15$$31 = ZEPHIR_IS_LONG(haveAccess, 1); if (_15$$31) { ZEPHIR_INIT_VAR(_16$$31); ZEPHIR_CALL_USER_FUNC(_16$$31, funcAccess); zephir_check_call_status(); _15$$31 = zephir_is_true(_16$$31); } RETURN_MM_BOOL(_15$$31); } ZEPHIR_INIT_VAR(parametersForFunction); array_init(parametersForFunction); ZEPHIR_CALL_METHOD(&numberOfRequiredParameters, reflectionFunction, "getnumberofrequiredparameters", NULL, 87); zephir_check_call_status(); ZEPHIR_CPY_WRT(userParametersSizeShouldBe, parameterNumber); zephir_is_iterable(reflectionParameters, &_18$$30, &_17$$30, 0, 0, "phalcon/acl/adapter/memory.zep", 737); for ( ; zephir_hash_get_current_data_ex(_18$$30, (void**) &_19$$30, &_17$$30) == SUCCESS ; zephir_hash_move_forward_ex(_18$$30, &_17$$30) ) { ZEPHIR_GET_HVALUE(reflectionParameter, _19$$30); ZEPHIR_CALL_METHOD(&reflectionClass, reflectionParameter, "getclass", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(¶meterToCheck, reflectionParameter, "getname", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(reflectionClass) != IS_NULL) { _20$$33 = Z_TYPE_P(roleObject) != IS_NULL; if (_20$$33) { ZEPHIR_CALL_METHOD(&_21$$33, reflectionClass, "isinstance", NULL, 0, roleObject); zephir_check_call_status(); _20$$33 = zephir_is_true(_21$$33); } if (_20$$33) { zephir_array_append(¶metersForFunction, roleObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 709); ZEPHIR_SEPARATE(userParametersSizeShouldBe); zephir_decrement(userParametersSizeShouldBe); continue; } _22$$33 = Z_TYPE_P(resourceObject) != IS_NULL; if (_22$$33) { ZEPHIR_CALL_METHOD(&_23$$33, reflectionClass, "isinstance", NULL, 0, resourceObject); zephir_check_call_status(); _22$$33 = zephir_is_true(_23$$33); } if (_22$$33) { zephir_array_append(¶metersForFunction, resourceObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 717); ZEPHIR_SEPARATE(userParametersSizeShouldBe); zephir_decrement(userParametersSizeShouldBe); continue; } _24$$33 = zephir_array_isset(parameters, parameterToCheck); if (_24$$33) { ZEPHIR_OBS_NVAR(_25$$33); zephir_array_fetch(&_25$$33, parameters, parameterToCheck, PH_NOISY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC); _24$$33 = Z_TYPE_P(_25$$33) == IS_OBJECT; } _26$$33 = _24$$33; if (_26$$33) { zephir_array_fetch(&_28$$33, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_27$$33, reflectionClass, "isinstance", NULL, 0, _28$$33); zephir_check_call_status(); _26$$33 = !zephir_is_true(_27$$33); } if (_26$$33) { ZEPHIR_INIT_NVAR(_29$$36); object_init_ex(_29$$36, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(_30$$36); zephir_array_fetch(&_31$$36, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 726 TSRMLS_CC); zephir_get_class(_30$$36, _31$$36, 0 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_32$$36, reflectionClass, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_33$$36); ZEPHIR_CONCAT_SVSVSVSVSVS(_33$$36, "Your passed parameter doesn't have the same class as the parameter in defined function when check ", roleName, " can ", access, " ", resourceName, ". Class passed: ", _30$$36, " , Class in defined function: ", _32$$36, "."); ZEPHIR_CALL_METHOD(NULL, _29$$36, "__construct", &_34, 9, _33$$36); zephir_check_call_status(); zephir_throw_exception_debug(_29$$36, "phalcon/acl/adapter/memory.zep", 727 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } if (zephir_array_isset(parameters, parameterToCheck)) { zephir_array_fetch(&_35$$37, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 733 TSRMLS_CC); zephir_array_append(¶metersForFunction, _35$$37, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 733); } } if (ZEPHIR_LT_LONG(userParametersSizeShouldBe, zephir_fast_count_int(parameters TSRMLS_CC))) { ZEPHIR_INIT_VAR(_36$$38); ZEPHIR_CONCAT_SVSVSVS(_36$$38, "Number of parameters in array is higher than the number of parameters in defined function when check ", roleName, " can ", access, " ", resourceName, ". Remember that more parameters than defined in function will be ignored."); ZEPHIR_SINIT_VAR(_37$$38); ZVAL_LONG(&_37$$38, 512); ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _36$$38, &_37$$38); zephir_check_call_status(); } if (zephir_fast_count_int(parametersForFunction TSRMLS_CC) == 0) { if (ZEPHIR_GT_LONG(numberOfRequiredParameters, 0)) { ZEPHIR_INIT_VAR(_39$$40); ZEPHIR_CONCAT_SVSVSVS(_39$$40, "You didn't provide any parameters when check ", roleName, " can ", access, " ", resourceName, ". We will use default action when no arguments."); ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _39$$40); zephir_check_call_status(); _40$$40 = ZEPHIR_IS_LONG(haveAccess, 1); if (_40$$40) { _41$$40 = zephir_fetch_nproperty_this(this_ptr, SL("_noArgumentsDefaultAction"), PH_NOISY_CC); _40$$40 = ZEPHIR_IS_LONG(_41$$40, 1); } RETURN_MM_BOOL(_40$$40); } _42$$39 = ZEPHIR_IS_LONG(haveAccess, 1); if (_42$$39) { ZEPHIR_INIT_VAR(_43$$39); ZEPHIR_CALL_USER_FUNC(_43$$39, funcAccess); zephir_check_call_status(); _42$$39 = zephir_is_true(_43$$39); } RETURN_MM_BOOL(_42$$39); } if (ZEPHIR_LE_LONG(numberOfRequiredParameters, zephir_fast_count_int(parametersForFunction TSRMLS_CC))) { _44$$41 = ZEPHIR_IS_LONG(haveAccess, 1); if (_44$$41) { ZEPHIR_INIT_VAR(_45$$41); ZEPHIR_CALL_USER_FUNC_ARRAY(_45$$41, funcAccess, parametersForFunction); zephir_check_call_status(); _44$$41 = zephir_is_true(_45$$41); } RETURN_MM_BOOL(_44$$41); } ZEPHIR_INIT_VAR(_46$$30); object_init_ex(_46$$30, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(_47$$30); ZEPHIR_CONCAT_SVSVSV(_47$$30, "You didn't provide all necessary parameters for defined function when check ", roleName, " can ", access, " ", resourceName); ZEPHIR_CALL_METHOD(NULL, _46$$30, "__construct", &_34, 9, _47$$30); zephir_check_call_status(); zephir_throw_exception_debug(_46$$30, "phalcon/acl/adapter/memory.zep", 766 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_MM_BOOL(ZEPHIR_IS_LONG(haveAccess, 1)); }
/** * Insert a row in the table with the specified data and types * returns the number of affected rows */ PHP_METHOD(Lynx_DBAL_Connection, insert) { int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zval *data = NULL, *types = NULL; zval *table_param = NULL, *data_param = NULL, *types_param = NULL, *query, *stmt = NULL, *value = NULL, *set, *columnName = NULL, *fields, **_2, *_3, *_4 = NULL, *_5, *_6 = NULL, *_7, *_8, *_9; zval *table = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &table_param, &data_param, &types_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); } data = data_param; if (!types_param) { ZEPHIR_INIT_VAR(types); array_init(types); } else { types = types_param; } ZEPHIR_INIT_VAR(set); array_init(set); ZEPHIR_INIT_VAR(fields); zephir_array_keys(fields, data TSRMLS_CC); zephir_is_iterable(data, &_1, &_0, 1, 0, "lynx/DBAL/Connection.zep", 70); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(columnName, _1, _0); ZEPHIR_GET_HVALUE(value, _2); if (zephir_array_isset(types, columnName)) { zephir_array_fetch(&_3, types, columnName, PH_NOISY | PH_READONLY, "lynx/DBAL/Connection.zep", 59 TSRMLS_CC); if (ZEPHIR_IS_LONG(_3, 10)) { zephir_array_append(&set, value, PH_SEPARATE, "lynx/DBAL/Connection.zep", 60); zephir_array_unset(&data, columnName, PH_SEPARATE); } else { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_SVS(_4, ":", columnName, ""); zephir_array_append(&set, _4, PH_SEPARATE, "lynx/DBAL/Connection.zep", 63); } } else { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_SVS(_4, ":", columnName, ""); zephir_array_append(&set, _4, PH_SEPARATE, "lynx/DBAL/Connection.zep", 66); } } _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, table); zephir_check_call_status(); ZEPHIR_INIT_VAR(_7); zephir_fast_join_str(_7, SL(","), fields TSRMLS_CC); ZEPHIR_INIT_VAR(_8); zephir_fast_join_str(_8, SL(","), set TSRMLS_CC); ZEPHIR_INIT_VAR(query); ZEPHIR_CONCAT_SVSVSVS(query, "INSERT INTO ", _6, " (", _7, ") VALUES (", _8, ")"); _9 = zephir_fetch_nproperty_this(this_ptr, SL("driver"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&stmt, _9, "prepare", NULL, query); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(stmt, "execute", NULL, data); zephir_check_call_status(); RETURN_MM(); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zephir_fcall_cache_entry *_16 = NULL; HashTable *_14; HashPosition _13; zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_8 = NULL, *_11 = NULL, *_12 = NULL, *_19 = NULL, *_24 = NULL; zval *_1, *_18 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *space, *twoSpaces, *underscore, *minus, *className, *namespaceSeparator, *prepareInternalClass, *preparedFunctionName, *html = NULL, *classReflection, *prepareUriClass, *functionName, *functionReflection, *traceArgs, *arguments, *argument = NULL, *filez, *line = NULL, *showFiles, *lines = NULL, *numberLines, *showFileFragment, *beforeLine, *afterLine, *lastLine = NULL, *commentPattern, *utf8, *entCompat, *tab, *comment, linePosition = zval_used_for_init, *currentLine = NULL, _0, *_2 = NULL, *_3 = NULL, *_5 = NULL, *_7 = NULL, *_9 = NULL, *_10, **_15, *_17, _20 = zval_used_for_init, _21, *_22, *_23 = NULL; int n, firstLine, i, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_INIT_VAR(space); ZVAL_STRING(space, " ", 1); ZEPHIR_INIT_VAR(twoSpaces); ZVAL_STRING(twoSpaces, " ", 1); ZEPHIR_INIT_VAR(underscore); ZVAL_STRING(underscore, "_", 1); ZEPHIR_INIT_VAR(minus); ZVAL_STRING(minus, "-", 1); ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_OBS_VAR(className); zephir_array_fetch_string(&className, trace, SL("class"), PH_NOISY, "phalcon/debug.zep", 355 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "/^Phalcon/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_3, "preg_match", &_4, _2, className); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_VAR(namespaceSeparator); ZVAL_STRING(namespaceSeparator, "\\", 1); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, namespaceSeparator, underscore, className TSRMLS_CC); ZEPHIR_INIT_VAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<span class=\"error-class\"><a target=\"_new\" href=\"http://docs.phalconphp.com/en/latest/api/", prepareUriClass, ".html\">", className, "</a></span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", &_6, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, classReflection, "isinternal", &_8); zephir_check_call_status(); if (zephir_is_true(_7)) { ZEPHIR_INIT_VAR(prepareInternalClass); ZEPHIR_INIT_NVAR(_2); zephir_fast_strtolower(_2, className); zephir_fast_str_replace(&prepareInternalClass, underscore, minus, _2 TSRMLS_CC); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<span class=\"error-class\"><a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a></span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SVS(_9, "<span class=\"error-class\">", className, "</span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } } zephir_array_fetch_string(&_10, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 396 TSRMLS_CC); zephir_concat_self(&html, _10 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 402 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", &_11, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_3, functionReflection, "isinternal", &_12); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, underscore, minus, functionName TSRMLS_CC); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "<span class=\"error-function\"><a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a></span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } else { ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVS(_9, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } } else { ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } } if (zephir_array_isset_string(trace, SS("args"))) { ZEPHIR_OBS_VAR(traceArgs); zephir_array_fetch_string(&traceArgs, trace, SL("args"), PH_NOISY, "phalcon/debug.zep", 436 TSRMLS_CC); if (zephir_fast_count_int(traceArgs TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_14, &_13, 0, 0, "phalcon/debug.zep", 451); for ( ; zephir_hash_get_current_data_ex(_14, (void**) &_15, &_13) == SUCCESS ; zephir_hash_move_forward_ex(_14, &_13) ) { ZEPHIR_GET_HVALUE(argument, _15); ZEPHIR_CALL_METHOD(&_3, this_ptr, "_getvardump", &_16, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-parameter\">", _3, "</span>"); zephir_array_append(&arguments, _5, PH_SEPARATE, "phalcon/debug.zep", 445); } ZEPHIR_INIT_NVAR(_2); zephir_fast_join_str(_2, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVS(_9, "(", _2, ")"); zephir_concat_self(&html, _9 TSRMLS_CC); } else { zephir_concat_self_str(&html, SL("()") TSRMLS_CC); } } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_17); zephir_array_fetch_string(&_17, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 462 TSRMLS_CC); zephir_get_strval(_18, _17); ZEPHIR_CPY_WRT(line, _18); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _5 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", &_19, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_20); ZVAL_LONG(&_20, firstLine); ZEPHIR_SINIT_VAR(_21); ZVAL_LONG(&_21, firstLine); ZEPHIR_INIT_VAR(_22); ZEPHIR_CONCAT_SVSVSVS(_22, "<pre class=\"prettyprint highlight:", &_20, ":", line, " linenums:", &_21, "\">"); zephir_concat_self(&html, _22 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_NVAR(_20); ZVAL_LONG(&_20, firstLine); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "<pre class=\"prettyprint highlight:", &_20, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _9 TSRMLS_CC); } ZEPHIR_INIT_VAR(commentPattern); ZVAL_STRING(commentPattern, "#\\*\\/#", 1); ZEPHIR_INIT_VAR(utf8); ZVAL_STRING(utf8, "UTF-8", 1); ZEPHIR_INIT_VAR(entCompat); ZVAL_LONG(entCompat, 2); ZEPHIR_INIT_VAR(tab); ZVAL_STRING(tab, "\t", 1); ZEPHIR_INIT_VAR(comment); ZVAL_STRING(comment, "* /", 1); i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_SINIT_NVAR(linePosition); ZVAL_LONG(&linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, &linePosition, PH_NOISY, "phalcon/debug.zep", 550 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_2); zephir_fast_trim(_2, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_3, "preg_match", &_4, commentPattern, _2); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_NVAR(_23); zephir_fast_str_replace(&_23, comment, space, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _23); } } } if (ZEPHIR_IS_STRING(currentLine, "\n")) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { if (ZEPHIR_IS_STRING(currentLine, "\r\n")) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_23); zephir_fast_str_replace(&_23, tab, twoSpaces, currentLine TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_7, "htmlentities", &_24, _23, entCompat, utf8); zephir_check_call_status(); zephir_concat_self(&html, _7 TSRMLS_CC); } } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }