PHP_METHOD(Test_Statements, test544Issue) { zephir_fcall_cache_entry *_8 = NULL; zval *step_param = NULL, *_0, *_1, *_2, *_3, *_4, *_5, _6 = zval_used_for_init, *_7 = NULL, *_9, *_10, *_11 = NULL; int step, filledWidth, unfilledWidth, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &step_param); if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a long/integer") TSRMLS_CC); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); _0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); _1 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); if (ZEPHIR_GT_LONG(_0, step)) { _2 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(_2) - 1)), _3 TSRMLS_CC) * step)); _4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); unfilledWidth = (((zephir_get_numberval(_4) - 1)) - filledWidth); _5 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, filledWidth); ZEPHIR_CALL_FUNCTION(&_7, "str_repeat", &_8, 17, _5, &_6); zephir_check_call_status(); _9 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC); _10 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); ZEPHIR_SINIT_NVAR(_6); ZVAL_LONG(&_6, unfilledWidth); ZEPHIR_CALL_FUNCTION(&_11, "str_repeat", &_8, 17, _10, &_6); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, _7, _9, _11); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(_1, step)) { _2 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3); zephir_check_call_status(); RETURN_MM(); } else { _2 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3); zephir_check_call_status(); RETURN_MM(); } }
PHP_METHOD(Test_Statements, test544Issue) { zephir_fcall_cache_entry *_8 = NULL; zval *step_param = NULL, _0, _1, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _9$$3, _10$$3, _11$$3, _12$$4, _13$$4, _14$$5, _15$$5; int step, ZEPHIR_LAST_CALL_STATUS, filledWidth = 0, unfilledWidth = 0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_9$$3); ZVAL_UNDEF(&_10$$3); ZVAL_UNDEF(&_11$$3); ZVAL_UNDEF(&_12$$4); ZVAL_UNDEF(&_13$$4); ZVAL_UNDEF(&_14$$5); ZVAL_UNDEF(&_15$$5); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &step_param); if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a int") TSRMLS_CC); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); zephir_read_property(&_0, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_GT_LONG(&_0, step)) { zephir_read_property(&_2$$3, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_3$$3, this_ptr, SL("totalSteps"), PH_NOISY_CC | PH_READONLY); filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(&_2$$3) - 1)), &_3$$3 TSRMLS_CC) * step)); zephir_read_property(&_4$$3, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); unfilledWidth = (((zephir_get_numberval(&_4$$3) - 1)) - filledWidth); zephir_read_property(&_5$$3, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6$$3, filledWidth); ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 17, &_5$$3, &_6$$3); zephir_check_call_status(); zephir_read_property(&_6$$3, this_ptr, SL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_9$$3, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_10$$3, unfilledWidth); ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 17, &_9$$3, &_10$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_7$$3, &_6$$3, &_11$$3); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_1, step)) { zephir_read_property(&_12$$4, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$4, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, &_12$$4, &_13$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_14$$5, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_15$$5, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, &_14$$5, &_15$$5); zephir_check_call_status(); RETURN_MM(); } }
/** * Returns a slice of the resultset to show in the pagination */ PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, getPaginate) { double roundedTotal = 0; zval *config = NULL, *items = NULL, *page = NULL, *_0, *_1, _2 = zval_used_for_init, *_3 = NULL, _4, *_5 = NULL, *_6; int ZEPHIR_LAST_CALL_STATUS, show = 0, pageNumber = 0, totalPages = 0, number = 0, before = 0, next = 0; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(config); zephir_read_property_this(&config, this_ptr, SL("_config"), PH_NOISY_CC); ZEPHIR_OBS_VAR(items); zephir_array_fetch_string(&items, config, SL("data"), PH_NOISY, "phalcon/paginator/adapter/nativearray.zep", 87 TSRMLS_CC); if (Z_TYPE_P(items) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_paginator_exception_ce, "Invalid data for paginator", "phalcon/paginator/adapter/nativearray.zep", 90); return; } ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_limitRows"), PH_NOISY_CC); show = zephir_get_intval(_0); ZEPHIR_OBS_VAR(_1); zephir_read_property_this(&_1, this_ptr, SL("_page"), PH_NOISY_CC); pageNumber = zephir_get_intval(_1); if (pageNumber <= 0) { pageNumber = 1; } number = zephir_fast_count_int(items TSRMLS_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, show); ZEPHIR_CALL_FUNCTION(&_3, "floatval", NULL, 322, &_2); zephir_check_call_status(); roundedTotal = zephir_safe_div_long_zval(number, _3 TSRMLS_CC); totalPages = (int) (roundedTotal); if (totalPages != roundedTotal) { totalPages++; } ZEPHIR_SINIT_NVAR(_2); ZVAL_LONG(&_2, (show * ((pageNumber - 1)))); ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, show); ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 396, items, &_2, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(items, _5); if (pageNumber < totalPages) { next = (pageNumber + 1); } else { next = totalPages; } if (pageNumber > 1) { before = (pageNumber - 1); } else { before = 1; } ZEPHIR_INIT_VAR(page); object_init(page); zephir_update_property_zval(page, SL("items"), items TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, 1); zephir_update_property_zval(page, SL("first"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, before); zephir_update_property_zval(page, SL("before"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, pageNumber); zephir_update_property_zval(page, SL("current"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, totalPages); zephir_update_property_zval(page, SL("last"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, next); zephir_update_property_zval(page, SL("next"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, totalPages); zephir_update_property_zval(page, SL("total_pages"), _6 TSRMLS_CC); ZEPHIR_INIT_ZVAL_NREF(_6); ZVAL_LONG(_6, number); zephir_update_property_zval(page, SL("total_items"), _6 TSRMLS_CC); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_limitRows"), PH_NOISY_CC); zephir_update_property_zval(page, SL("limit"), _6 TSRMLS_CC); RETURN_CCTOR(page); }
/** * Resize the image to the given size */ PHP_METHOD(Phalcon_Image_Adapter, resize) { zephir_fcall_cache_entry *_12 = NULL; zend_bool _0, _4; double ratio; zval *width_param = NULL, *height_param = NULL, *master_param = NULL, *_1 = NULL, *_2, *_3, *_5, *_6, *_7 = NULL, *_8, _9, *_10 = NULL, *_11 = NULL, _13, *_14 = NULL, *_15 = NULL, *_16; int width, height, master, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 3, &width_param, &height_param, &master_param); if (!width_param) { width = 0; } else { width = zephir_get_intval(width_param); } if (!height_param) { height = 0; } else { height = zephir_get_intval(height_param); } if (!master_param) { master = 4; } else { master = zephir_get_intval(master_param); } if (master == 7) { _0 = !width; if (!(_0)) { _0 = !height; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "width and height must be specified", "phalcon/image/adapter.zep", 80); return; } } else { if (master == 4) { _0 = !width; if (!(_0)) { _0 = !height; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "width and height must be specified", "phalcon/image/adapter.zep", 88); return; } ZEPHIR_INIT_VAR(_1); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); if ((zephir_safe_div_zval_long(_2, width TSRMLS_CC)) > (int) (zephir_safe_div_zval_long(_3, height TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 2); } else { ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 3); } master = zephir_get_numberval(_1); } if (master == 5) { _4 = !width; if (!(_4)) { _4 = !height; } if (_4) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "width and height must be specified", "phalcon/image/adapter.zep", 97); return; } ZEPHIR_INIT_LNVAR(_1); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); if ((zephir_safe_div_zval_long(_2, width TSRMLS_CC)) > (int) (zephir_safe_div_zval_long(_3, height TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 3); } else { ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 2); } master = zephir_get_numberval(_1); } do { if (master == 2) { if (!(width)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "width must be specified", "phalcon/image/adapter.zep", 107); return; } _2 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); height = (long) (zephir_safe_div_long_zval((zephir_get_numberval(_2) * width), _3 TSRMLS_CC)); break; } if (master == 3) { if (!(height)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "height must be specified", "phalcon/image/adapter.zep", 114); return; } _2 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); width = (long) (zephir_safe_div_long_zval((zephir_get_numberval(_2) * height), _3 TSRMLS_CC)); break; } if (master == 6) { _4 = !width; if (!(_4)) { _4 = !height; } if (_4) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "width and height must be specified", "phalcon/image/adapter.zep", 121); return; } _2 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); ZEPHIR_INIT_LNVAR(_1); div_function(_1, _2, _3 TSRMLS_CC); ratio = zephir_get_numberval(_1); if ((zephir_safe_div_long_long(width, height TSRMLS_CC)) > ratio) { _2 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); height = (long) (zephir_safe_div_long_zval((zephir_get_numberval(_2) * width), _3 TSRMLS_CC)); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_width"), PH_NOISY_CC); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY_CC); width = (long) (zephir_safe_div_long_zval((zephir_get_numberval(_5) * height), _6 TSRMLS_CC)); } break; } if (master == 1) { if (!(width)) { ZEPHIR_OBS_VAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_width"), PH_NOISY_CC); width = zephir_get_intval(_7); } if (!(height)) { ZEPHIR_OBS_NVAR(_7); zephir_read_property_this(&_7, this_ptr, SL("_height"), PH_NOISY_CC); width = zephir_get_intval(_7); } break; } } while(0); } ZEPHIR_INIT_VAR(_8); ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, width); zephir_round(_8, &_9, NULL, NULL TSRMLS_CC); ZEPHIR_INIT_VAR(_10); ZVAL_LONG(_10, 1); ZEPHIR_CALL_FUNCTION(&_11, "max", &_12, 68, _8, _10); zephir_check_call_status(); width = zephir_get_intval(_11); ZEPHIR_INIT_NVAR(_10); ZEPHIR_SINIT_VAR(_13); ZVAL_LONG(&_13, height); zephir_round(_10, &_13, NULL, NULL TSRMLS_CC); ZEPHIR_INIT_VAR(_14); ZVAL_LONG(_14, 1); ZEPHIR_CALL_FUNCTION(&_15, "max", &_12, 68, _10, _14); zephir_check_call_status(); height = zephir_get_intval(_15); ZEPHIR_INIT_NVAR(_14); ZVAL_LONG(_14, width); ZEPHIR_INIT_VAR(_16); ZVAL_LONG(_16, height); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_resize", NULL, 0, _14, _16); zephir_check_call_status(); RETURN_THIS(); }