Hello community,

here is the log from the commit of package php7-ice for openSUSE:Factory 
checked in at 2020-09-14 12:27:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/php7-ice (Old)
 and      /work/SRC/openSUSE:Factory/.php7-ice.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "php7-ice"

Mon Sep 14 12:27:15 2020 rev:10 rq:833915 version:1.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/php7-ice/php7-ice.changes        2020-05-11 
13:43:15.569362114 +0200
+++ /work/SRC/openSUSE:Factory/.php7-ice.new.4249/php7-ice.changes      
2020-09-14 12:29:10.973131348 +0200
@@ -1,0 +2,8 @@
+Sat Sep 12 06:11:32 UTC 2020 - Mariusz <mruz@localhost>
+
+- Ice 1.6.2
+ * Model, get related record if field is null fix #275
+ * Pagination, calculate if data is array or total is specified #273
+ * Url, fixed getStatic() #193 
+
+-------------------------------------------------------------------

Old:
----
  ice-1.6.1.tar.gz

New:
----
  ice-1.6.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ php7-ice.spec ++++++
--- /var/tmp/diff_new_pack.Tryvsc/_old  2020-09-14 12:29:11.725131827 +0200
+++ /var/tmp/diff_new_pack.Tryvsc/_new  2020-09-14 12:29:11.729131830 +0200
@@ -22,7 +22,7 @@
 %define _name   ice
 
 Name:           %{_php}-%{_name}
-Version:        1.6.1
+Version:        1.6.2
 Release:        0
 Summary:        PHP framework delivered as C extension
 License:        BSD-3-Clause

++++++ ice-1.6.1.tar.gz -> ice-1.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/CHANGELOG.md 
new/framework-1.6.2/CHANGELOG.md
--- old/framework-1.6.1/CHANGELOG.md    2020-05-10 16:48:24.000000000 +0200
+++ new/framework-1.6.2/CHANGELOG.md    2020-09-12 08:36:18.000000000 +0200
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Sat Sep 12 06:11:32 UTC 2020
+
+- Ice 1.6.2
+ * Model, get related record if field is null fix #275
+ * Pagination, calculate if data is array or total is specified #273
+ * Url, fixed getStatic() #193
+
+-------------------------------------------------------------------
 Sun May 10 14:32:39 UTC 2020
 
 - Ice 1.6.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/ice/mvc/model.zep.c 
new/framework-1.6.2/build/php7/ice/mvc/model.zep.c
--- old/framework-1.6.1/build/php7/ice/mvc/model.zep.c  2020-05-10 
16:48:24.000000000 +0200
+++ new/framework-1.6.2/build/php7/ice/mvc/model.zep.c  2020-09-12 
08:36:18.000000000 +0200
@@ -1777,6 +1777,33 @@
 }
 
 /**
+ * Check whether model is loaded.
+ *
+ * @return boolean
+ */
+PHP_METHOD(Ice_Mvc_Model, loaded) {
+
+       zval _0, _1;
+       zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
+       zval *this_ptr = getThis();
+
+       ZVAL_UNDEF(&_0);
+       ZVAL_UNDEF(&_1);
+
+       ZEPHIR_MM_GROW();
+
+       ZEPHIR_INIT_VAR(&_0);
+       zephir_read_property(&_1, this_ptr, ZEND_STRL("isLoaded"), PH_NOISY_CC 
| PH_READONLY);
+       if (zephir_is_true(&_1)) {
+               ZVAL_BOOL(&_0, 1);
+       } else {
+               ZVAL_BOOL(&_0, 0);
+       }
+       RETURN_CCTOR(&_0);
+
+}
+
+/**
  * Get the last Db error.
  *
  * @return mixed
@@ -2068,7 +2095,7 @@
                zephir_check_call_status();
                ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 12, 
&_3$$3);
                zephir_check_call_status();
-               zephir_throw_exception_debug(&_1$$3, "ice/mvc/model.zep", 697);
+               zephir_throw_exception_debug(&_1$$3, "ice/mvc/model.zep", 707);
                ZEPHIR_MM_RESTORE();
                return;
        }
@@ -2078,7 +2105,7 @@
        zephir_array_isset_string_fetch(&referenceModel, &relation, 
SL("referenceModel"), 0);
        ZEPHIR_OBS_VAR(&referencedField);
        zephir_array_isset_string_fetch(&referencedField, &relation, 
SL("referencedField"), 0);
-       zephir_array_fetch_string(&_4, &relation, SL("type"), PH_NOISY | 
PH_READONLY, "ice/mvc/model.zep", 704);
+       zephir_array_fetch_string(&_4, &relation, SL("type"), PH_NOISY | 
PH_READONLY, "ice/mvc/model.zep", 714);
        do {
                if (ZEPHIR_IS_LONG(&_4, 1) || ZEPHIR_IS_LONG(&_4, 2)) {
                        ZEPHIR_OBS_VAR(&_5$$4);
@@ -2092,7 +2119,7 @@
                        ZEPHIR_INIT_VAR(&result);
                        ZEPHIR_LAST_CALL_STATUS = 
zephir_create_instance_params(&result, &referenceModel, &_6$$4);
                        zephir_check_call_status();
-                       ZEPHIR_CALL_METHOD(&_7$$4, &result, "count", NULL, 0);
+                       ZEPHIR_CALL_METHOD(&_7$$4, &result, "loaded", NULL, 0);
                        zephir_check_call_status();
                        if (!(zephir_is_true(&_7$$4))) {
                                RETURN_MM_BOOL(0);
@@ -2172,7 +2199,7 @@
                if (Z_TYPE_P(fields) == IS_ARRAY) {
                        ZEPHIR_INIT_VAR(&rules);
                        array_init(&rules);
-                       zephir_is_iterable(fields, 0, "ice/mvc/model.zep", 755);
+                       zephir_is_iterable(fields, 0, "ice/mvc/model.zep", 765);
                        if (Z_TYPE_P(fields) == IS_ARRAY) {
                                ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(fields), _2$$4)
                                {
@@ -2181,7 +2208,7 @@
                                        zephir_read_property(&_4$$5, this_ptr, 
ZEND_STRL("rules"), PH_NOISY_CC | PH_READONLY);
                                        if (zephir_array_isset(&_4$$5, &field)) 
{
                                                zephir_read_property(&_5$$6, 
this_ptr, ZEND_STRL("rules"), PH_NOISY_CC | PH_READONLY);
-                                               zephir_array_fetch(&_6$$6, 
&_5$$6, &field, PH_NOISY | PH_READONLY, "ice/mvc/model.zep", 751);
+                                               zephir_array_fetch(&_6$$6, 
&_5$$6, &field, PH_NOISY | PH_READONLY, "ice/mvc/model.zep", 761);
                                                
zephir_array_update_zval(&rules, &field, &_6$$6, PH_COPY | PH_SEPARATE);
                                        }
                                } ZEND_HASH_FOREACH_END();
@@ -2199,7 +2226,7 @@
                                                zephir_read_property(&_7$$7, 
this_ptr, ZEND_STRL("rules"), PH_NOISY_CC | PH_READONLY);
                                                if (zephir_array_isset(&_7$$7, 
&field)) {
                                                        
zephir_read_property(&_8$$8, this_ptr, ZEND_STRL("rules"), PH_NOISY_CC | 
PH_READONLY);
-                                                       
zephir_array_fetch(&_9$$8, &_8$$8, &field, PH_NOISY | PH_READONLY, 
"ice/mvc/model.zep", 751);
+                                                       
zephir_array_fetch(&_9$$8, &_8$$8, &field, PH_NOISY | PH_READONLY, 
"ice/mvc/model.zep", 761);
                                                        
zephir_array_update_zval(&rules, &field, &_9$$8, PH_COPY | PH_SEPARATE);
                                                }
                                        ZEPHIR_CALL_METHOD(NULL, fields, 
"next", NULL, 0);
@@ -2210,7 +2237,7 @@
                        RETURN_CCTOR(&rules);
                } else if (_0$$3) {
                        zephir_read_property(&_10$$9, this_ptr, 
ZEND_STRL("rules"), PH_NOISY_CC | PH_READONLY);
-                       zephir_array_fetch(&_11$$9, &_10$$9, fields, PH_NOISY | 
PH_READONLY, "ice/mvc/model.zep", 757);
+                       zephir_array_fetch(&_11$$9, &_10$$9, fields, PH_NOISY | 
PH_READONLY, "ice/mvc/model.zep", 767);
                        RETURN_CTOR(&_11$$9);
                }
                RETURN_MM_NULL();
@@ -2378,7 +2405,7 @@
        zephir_check_call_status();
        ZEPHIR_CALL_METHOD(NULL, &_3, "__construct", NULL, 12, &_5);
        zephir_check_call_status();
-       zephir_throw_exception_debug(&_3, "ice/mvc/model.zep", 818);
+       zephir_throw_exception_debug(&_3, "ice/mvc/model.zep", 828);
        ZEPHIR_MM_RESTORE();
        return;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/ice/mvc/model.zep.h 
new/framework-1.6.2/build/php7/ice/mvc/model.zep.h
--- old/framework-1.6.1/build/php7/ice/mvc/model.zep.h  2020-05-10 
16:48:24.000000000 +0200
+++ new/framework-1.6.2/build/php7/ice/mvc/model.zep.h  2020-09-12 
08:36:18.000000000 +0200
@@ -33,6 +33,7 @@
 PHP_METHOD(Ice_Mvc_Model, save);
 PHP_METHOD(Ice_Mvc_Model, delete);
 PHP_METHOD(Ice_Mvc_Model, exists);
+PHP_METHOD(Ice_Mvc_Model, loaded);
 PHP_METHOD(Ice_Mvc_Model, getError);
 PHP_METHOD(Ice_Mvc_Model, belongsTo);
 PHP_METHOD(Ice_Mvc_Model, hasOne);
@@ -147,6 +148,13 @@
        ZEND_ARG_INFO(0, filters)
 ZEND_END_ARG_INFO()
 
+#if PHP_VERSION_ID >= 70200
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ice_mvc_model_loaded, 0, 0, 
_IS_BOOL, 0)
+#else
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ice_mvc_model_loaded, 0, 0, 
_IS_BOOL, NULL, 0)
+#endif
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_ice_mvc_model_belongsto, 0, 0, 3)
 #if PHP_VERSION_ID >= 70200
        ZEND_ARG_TYPE_INFO(0, field, IS_STRING, 0)
@@ -278,6 +286,7 @@
        PHP_ME(Ice_Mvc_Model, save, arginfo_ice_mvc_model_save, ZEND_ACC_PUBLIC)
        PHP_ME(Ice_Mvc_Model, delete, arginfo_ice_mvc_model_delete, 
ZEND_ACC_PUBLIC)
        PHP_ME(Ice_Mvc_Model, exists, arginfo_ice_mvc_model_exists, 
ZEND_ACC_PUBLIC)
+       PHP_ME(Ice_Mvc_Model, loaded, arginfo_ice_mvc_model_loaded, 
ZEND_ACC_PUBLIC)
        PHP_ME(Ice_Mvc_Model, getError, NULL, ZEND_ACC_PUBLIC)
        PHP_ME(Ice_Mvc_Model, belongsTo, arginfo_ice_mvc_model_belongsto, 
ZEND_ACC_PUBLIC)
        PHP_ME(Ice_Mvc_Model, hasOne, arginfo_ice_mvc_model_hasone, 
ZEND_ACC_PUBLIC)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/ice/mvc/url.zep.c 
new/framework-1.6.2/build/php7/ice/mvc/url.zep.c
--- old/framework-1.6.1/build/php7/ice/mvc/url.zep.c    2020-05-10 
16:48:24.000000000 +0200
+++ new/framework-1.6.2/build/php7/ice/mvc/url.zep.c    2020-09-12 
08:36:18.000000000 +0200
@@ -14,10 +14,10 @@
 #include "kernel/main.h"
 #include "kernel/object.h"
 #include "kernel/memory.h"
+#include "kernel/string.h"
+#include "kernel/operators.h"
 #include "kernel/concat.h"
 #include "kernel/fcall.h"
-#include "kernel/operators.h"
-#include "kernel/string.h"
 #include "kernel/array.h"
 
 
@@ -100,14 +100,16 @@
  */
 PHP_METHOD(Ice_Mvc_Url, getStatic) {
 
+       unsigned char _2;
        zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
-       zend_long ZEPHIR_LAST_CALL_STATUS;
-       zval *uri_param = NULL, _0;
+       zval *uri_param = NULL, staticUri, _0, _1;
        zval uri;
        zval *this_ptr = getThis();
 
        ZVAL_UNDEF(&uri);
+       ZVAL_UNDEF(&staticUri);
        ZVAL_UNDEF(&_0);
+       ZVAL_UNDEF(&_1);
 
        ZEPHIR_MM_GROW();
        zephir_fetch_params(1, 0, 1, &uri_param);
@@ -120,9 +122,16 @@
        }
 
 
-       ZEPHIR_CALL_METHOD(&_0, this_ptr, "getstaticuri", NULL, 0);
-       zephir_check_call_status();
-       ZEPHIR_CONCAT_VV(return_value, &_0, &uri);
+       zephir_read_property(&_0, this_ptr, ZEND_STRL("staticUri"), PH_NOISY_CC 
| PH_READONLY);
+       ZEPHIR_INIT_VAR(&_1);
+       ZVAL_STRING(&_1, "/");
+       ZEPHIR_INIT_VAR(&staticUri);
+       zephir_fast_trim(&staticUri, &_0, &_1, ZEPHIR_TRIM_RIGHT);
+       _2 = ZEPHIR_STRING_OFFSET(&uri, 0);
+       if (_2 != '/') {
+               zephir_concat_self_str(&staticUri, SL("/"));
+       }
+       ZEPHIR_CONCAT_VV(return_value, &staticUri, &uri);
        RETURN_MM();
 
 }
@@ -139,25 +148,25 @@
 
        zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
        zend_long ZEPHIR_LAST_CALL_STATUS;
-       zend_bool local, _0$$3, _1$$3, _6$$8, _7$$10, _9$$12;
-       zval *uri = NULL, uri_sub, *args = NULL, args_sub, *local_param = NULL, 
_GET, __$null, baseUri, queryString, _2$$4, _3$$4, _4$$4, _5$$4, _8$$11, 
_10$$13, _11$$13, _12$$14, _13$$15;
+       zephir_fcall_cache_entry *_3 = NULL;
+       zend_bool local, _0, _4$$3, _6$$4, _7$$6;
+       zval *uri = NULL, uri_sub, *args = NULL, args_sub, *local_param = NULL, 
_GET, __$null, queryString, _1$$3, _2$$3, _5$$3, _8$$7, _9$$7, _10$$9, _11$$9, 
_12$$10, _13$$11;
        zval *this_ptr = getThis();
 
        ZVAL_UNDEF(&uri_sub);
        ZVAL_UNDEF(&args_sub);
        ZVAL_UNDEF(&_GET);
        ZVAL_NULL(&__$null);
-       ZVAL_UNDEF(&baseUri);
        ZVAL_UNDEF(&queryString);
-       ZVAL_UNDEF(&_2$$4);
-       ZVAL_UNDEF(&_3$$4);
-       ZVAL_UNDEF(&_4$$4);
-       ZVAL_UNDEF(&_5$$4);
-       ZVAL_UNDEF(&_8$$11);
-       ZVAL_UNDEF(&_10$$13);
-       ZVAL_UNDEF(&_11$$13);
-       ZVAL_UNDEF(&_12$$14);
-       ZVAL_UNDEF(&_13$$15);
+       ZVAL_UNDEF(&_1$$3);
+       ZVAL_UNDEF(&_2$$3);
+       ZVAL_UNDEF(&_5$$3);
+       ZVAL_UNDEF(&_8$$7);
+       ZVAL_UNDEF(&_9$$7);
+       ZVAL_UNDEF(&_10$$9);
+       ZVAL_UNDEF(&_11$$9);
+       ZVAL_UNDEF(&_12$$10);
+       ZVAL_UNDEF(&_13$$11);
 
        ZEPHIR_MM_GROW();
        zephir_get_global(&_GET, SL("_GET"));
@@ -180,74 +189,61 @@
        }
 
 
-       if (!(local)) {
-               _0$$3 = Z_TYPE_P(uri) == IS_STRING;
-               if (_0$$3) {
-                       _1$$3 = zephir_memnstr_str(uri, SL("//"), 
"ice/mvc/url.zep", 44);
-                       if (!(_1$$3)) {
-                               _1$$3 = zephir_memnstr_str(uri, SL(":"), 
"ice/mvc/url.zep", 44);
-                       }
-                       _0$$3 = _1$$3;
-               }
-               if (_0$$3) {
-                       ZEPHIR_INIT_VAR(&_2$$4);
-                       ZEPHIR_INIT_VAR(&_3$$4);
-                       ZVAL_STRING(&_3$$4, 
"#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i");
-                       ZEPHIR_INIT_VAR(&_4$$4);
-                       ZEPHIR_INIT_VAR(&_5$$4);
-                       ZVAL_STRING(&_5$$4, 
"#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i");
-                       zephir_preg_match(&_4$$4, &_5$$4, uri, &_2$$4, 0, 0 , 0 
);
-                       if (zephir_is_true(&_4$$4)) {
-                               local = 0;
-                       } else {
-                               local = 1;
-                       }
-               } else {
-                       local = 1;
+       _0 = !local;
+       if (_0) {
+               _0 = !(ZEPHIR_IS_EMPTY(uri));
+       }
+       if (_0) {
+               ZVAL_LONG(&_1$$3, 1);
+               ZEPHIR_CALL_FUNCTION(&_2$$3, "parse_url", &_3, 78, uri, &_1$$3);
+               zephir_check_call_status();
+               _4$$3 = ZEPHIR_IS_EMPTY(&_2$$3);
+               if (_4$$3) {
+                       ZVAL_LONG(&_1$$3, 0);
+                       ZEPHIR_CALL_FUNCTION(&_5$$3, "parse_url", &_3, 78, uri, 
&_1$$3);
+                       zephir_check_call_status();
+                       _4$$3 = ZEPHIR_IS_EMPTY(&_5$$3);
                }
+               local = _4$$3;
        }
-       ZEPHIR_CALL_METHOD(&baseUri, this_ptr, "getbaseuri", NULL, 0);
-       zephir_check_call_status();
        if (local) {
-               _6$$8 = ZEPHIR_IS_FALSE_IDENTICAL(uri);
-               if (_6$$8) {
-                       _6$$8 = zephir_array_isset_string(&_GET, SL("_url"));
+               _6$$4 = ZEPHIR_IS_FALSE_IDENTICAL(uri);
+               if (_6$$4) {
+                       _6$$4 = zephir_array_isset_string(&_GET, SL("_url"));
                }
-               if (_6$$8) {
+               if (_6$$4) {
                        ZEPHIR_OBS_NVAR(uri);
-                       zephir_array_fetch_string(uri, &_GET, SL("_url"), 
PH_NOISY, "ice/mvc/url.zep", 60);
+                       zephir_array_fetch_string(uri, &_GET, SL("_url"), 
PH_NOISY, "ice/mvc/url.zep", 55);
                } else {
-                       _7$$10 = !(zephir_start_with_str(uri, SL("#")));
-                       if (_7$$10) {
-                               _7$$10 = !(zephir_start_with_str(uri, SL("?")));
+                       _7$$6 = !(zephir_start_with_str(uri, SL("#")));
+                       if (_7$$6) {
+                               _7$$6 = !(zephir_start_with_str(uri, SL("?")));
                        }
-                       if (_7$$10) {
-                               ZEPHIR_INIT_VAR(&_8$$11);
-                               ZEPHIR_CONCAT_VV(&_8$$11, &baseUri, uri);
-                               ZEPHIR_CPY_WRT(uri, &_8$$11);
+                       if (_7$$6) {
+                               ZEPHIR_CALL_METHOD(&_8$$7, this_ptr, 
"getbaseuri", NULL, 0);
+                               zephir_check_call_status();
+                               ZEPHIR_INIT_VAR(&_9$$7);
+                               ZEPHIR_CONCAT_VV(&_9$$7, &_8$$7, uri);
+                               ZEPHIR_CPY_WRT(uri, &_9$$7);
                        }
                }
        }
        if (zephir_is_true(args)) {
                ZEPHIR_CALL_FUNCTION(&queryString, "http_build_query", NULL, 
18, args);
                zephir_check_call_status();
-               _9$$12 = Z_TYPE_P(&queryString) == IS_STRING;
-               if (_9$$12) {
-                       _9$$12 = ((zephir_fast_strlen_ev(&queryString)) ? 1 : 
0);
-               }
-               if (_9$$12) {
-                       ZEPHIR_INIT_VAR(&_10$$13);
-                       ZVAL_STRING(&_10$$13, "?");
-                       ZEPHIR_INIT_VAR(&_11$$13);
-                       zephir_fast_strpos(&_11$$13, &queryString, &_10$$13, 0 
);
-                       if (!ZEPHIR_IS_FALSE_IDENTICAL(&_11$$13)) {
-                               ZEPHIR_INIT_VAR(&_12$$14);
-                               ZEPHIR_CONCAT_SV(&_12$$14, "&", &queryString);
-                               zephir_concat_self(uri, &_12$$14);
+               if (zephir_is_true(&queryString)) {
+                       ZEPHIR_INIT_VAR(&_10$$9);
+                       ZVAL_STRING(&_10$$9, "?");
+                       ZEPHIR_INIT_VAR(&_11$$9);
+                       zephir_fast_strpos(&_11$$9, uri, &_10$$9, 0 );
+                       if (!ZEPHIR_IS_FALSE_IDENTICAL(&_11$$9)) {
+                               ZEPHIR_INIT_VAR(&_12$$10);
+                               ZEPHIR_CONCAT_SV(&_12$$10, "&", &queryString);
+                               zephir_concat_self(uri, &_12$$10);
                        } else {
-                               ZEPHIR_INIT_VAR(&_13$$15);
-                               ZEPHIR_CONCAT_SV(&_13$$15, "?", &queryString);
-                               zephir_concat_self(uri, &_13$$15);
+                               ZEPHIR_INIT_VAR(&_13$$11);
+                               ZEPHIR_CONCAT_SV(&_13$$11, "?", &queryString);
+                               zephir_concat_self(uri, &_13$$11);
                        }
                }
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/ice/pagination.zep.c 
new/framework-1.6.2/build/php7/ice/pagination.zep.c
--- old/framework-1.6.1/build/php7/ice/pagination.zep.c 2020-05-10 
16:48:24.000000000 +0200
+++ new/framework-1.6.2/build/php7/ice/pagination.zep.c 2020-09-12 
08:36:18.000000000 +0200
@@ -113,116 +113,135 @@
  */
 PHP_METHOD(Ice_Pagination, calculate) {
 
-       zval _10;
-       zend_bool _2;
-       zval items, data, _0, _1, _3, _4, _5, _6, _7, _8, _9;
+       zval _15;
+       zend_bool _9, _3$$3;
+       zval items, data, total, _0, _4, _5, _6, _7, _8, _14, _1$$3, _2$$3, 
_10$$8, _11$$8, _12$$8, _13$$8;
        zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
-       zend_long ZEPHIR_LAST_CALL_STATUS, limit = 0, page = 0, pages = 0, 
total = 0, previous = 0, next = 0;
+       zend_long ZEPHIR_LAST_CALL_STATUS, limit = 0, page = 0, pages = 0, 
previous = 0, next = 0;
        zval *this_ptr = getThis();
 
        ZVAL_UNDEF(&items);
        ZVAL_UNDEF(&data);
+       ZVAL_UNDEF(&total);
        ZVAL_UNDEF(&_0);
-       ZVAL_UNDEF(&_1);
-       ZVAL_UNDEF(&_3);
        ZVAL_UNDEF(&_4);
        ZVAL_UNDEF(&_5);
        ZVAL_UNDEF(&_6);
        ZVAL_UNDEF(&_7);
        ZVAL_UNDEF(&_8);
-       ZVAL_UNDEF(&_9);
-       ZVAL_UNDEF(&_10);
+       ZVAL_UNDEF(&_14);
+       ZVAL_UNDEF(&_1$$3);
+       ZVAL_UNDEF(&_2$$3);
+       ZVAL_UNDEF(&_10$$8);
+       ZVAL_UNDEF(&_11$$8);
+       ZVAL_UNDEF(&_12$$8);
+       ZVAL_UNDEF(&_13$$8);
+       ZVAL_UNDEF(&_15);
 
        ZEPHIR_MM_GROW();
 
        ZEPHIR_INIT_VAR(&_0);
-       array_init(&_0);
-       ZEPHIR_INIT_VAR(&_1);
-       ZVAL_STRING(&_1, "data");
-       ZEPHIR_CALL_METHOD(&items, this_ptr, "get", NULL, 0, &_1, &_0);
+       ZVAL_STRING(&_0, "total");
+       ZEPHIR_CALL_METHOD(&total, this_ptr, "get", NULL, 0, &_0);
        zephir_check_call_status();
-       _2 = Z_TYPE_P(&items) != IS_ARRAY;
-       if (_2) {
-               _2 = !((zephir_instance_of_ev(&items, ice_arr_ce)));
-       }
-       if (_2) {
-               ZEPHIR_THROW_EXCEPTION_DEBUG_STR(ice_exception_ce, "Invalid 
data for pagination", "ice/pagination.zep", 48);
-               return;
-       }
-       if (zephir_instance_of_ev(&items, ice_arr_ce)) {
-               ZEPHIR_CALL_METHOD(&data, &items, "all", NULL, 0);
+       if (Z_TYPE_P(&total) == IS_NULL) {
+               ZEPHIR_INIT_VAR(&_1$$3);
+               array_init(&_1$$3);
+               ZEPHIR_INIT_VAR(&_2$$3);
+               ZVAL_STRING(&_2$$3, "data");
+               ZEPHIR_CALL_METHOD(&data, this_ptr, "get", NULL, 0, &_2$$3, 
&_1$$3);
                zephir_check_call_status();
-       } else {
-               ZEPHIR_CPY_WRT(&data, &items);
+               _3$$3 = Z_TYPE_P(&data) == IS_OBJECT;
+               if (_3$$3) {
+                       _3$$3 = (zephir_instance_of_ev(&data, ice_arr_ce));
+               }
+               if (_3$$3) {
+                       ZEPHIR_CALL_METHOD(&items, &data, "all", NULL, 0);
+                       zephir_check_call_status();
+               } else if (Z_TYPE_P(&data) == IS_ARRAY) {
+                       ZEPHIR_CPY_WRT(&items, &data);
+               } else {
+                       ZEPHIR_THROW_EXCEPTION_DEBUG_STR(ice_exception_ce, 
"Invalid data for pagination", "ice/pagination.zep", 58);
+                       return;
+               }
+               ZEPHIR_INIT_NVAR(&total);
+               ZVAL_LONG(&total, zephir_fast_count_int(&items));
        }
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_STRING(&_1, "limit");
-       ZVAL_LONG(&_4, 10);
-       ZEPHIR_CALL_METHOD(&_3, this_ptr, "get", NULL, 0, &_1, &_4);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_STRING(&_0, "limit");
+       ZVAL_LONG(&_5, 10);
+       ZEPHIR_CALL_METHOD(&_4, this_ptr, "get", NULL, 0, &_0, &_5);
+       zephir_check_call_status();
+       limit = zephir_get_intval(&_4);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_STRING(&_0, "page");
+       ZVAL_LONG(&_5, 1);
+       ZEPHIR_CALL_METHOD(&_6, this_ptr, "get", NULL, 0, &_0, &_5);
        zephir_check_call_status();
-       limit = zephir_get_intval(&_3);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_STRING(&_1, "page");
-       ZVAL_LONG(&_4, 1);
-       ZEPHIR_CALL_METHOD(&_5, this_ptr, "get", NULL, 0, &_1, &_4);
-       zephir_check_call_status();
-       page = zephir_get_intval(&_5);
-       total = zephir_fast_count_int(&items);
-       ZEPHIR_INIT_VAR(&_6);
+       page = zephir_get_intval(&_6);
+       ZEPHIR_INIT_VAR(&_7);
        if (limit) {
-               ZEPHIR_INIT_NVAR(&_6);
-               ZVAL_LONG(&_6, limit);
+               ZEPHIR_INIT_NVAR(&_7);
+               ZVAL_LONG(&_7, limit);
        } else {
-               ZEPHIR_INIT_NVAR(&_6);
-               ZVAL_LONG(&_6, 1);
+               ZEPHIR_INIT_NVAR(&_7);
+               ZVAL_LONG(&_7, 1);
        }
-       ZVAL_DOUBLE(&_4, zephir_safe_div_long_long(total, 
zephir_get_intval(&_6)));
-       pages = (int) zephir_ceil(&_4);
+       ZVAL_DOUBLE(&_5, zephir_safe_div_zval_long(&total, 
zephir_get_intval(&_7)));
+       pages = (int) zephir_ceil(&_5);
        if (page <= 0) {
                page = 1;
        }
-       ZVAL_LONG(&_7, (limit * ((page - 1))));
-       ZVAL_LONG(&_8, limit);
-       ZEPHIR_CALL_FUNCTION(&_9, "array_slice", NULL, 124, &data, &_7, &_8);
-       zephir_check_call_status();
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_STRING(&_1, "items");
-       ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_1, &_9);
-       zephir_check_call_status();
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_STRING(&_0, "items");
+       ZEPHIR_CALL_METHOD(&_8, this_ptr, "has", NULL, 0, &_0);
+       zephir_check_call_status();
+       _9 = !zephir_is_true(&_8);
+       if (_9) {
+               _9 = zephir_is_true(&items);
+       }
+       if (_9) {
+               ZVAL_LONG(&_10$$8, (limit * ((page - 1))));
+               ZVAL_LONG(&_11$$8, limit);
+               ZEPHIR_CALL_FUNCTION(&_12$$8, "array_slice", NULL, 124, &items, 
&_10$$8, &_11$$8);
+               zephir_check_call_status();
+               ZEPHIR_INIT_VAR(&_13$$8);
+               ZVAL_STRING(&_13$$8, "items");
+               ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_13$$8, 
&_12$$8);
+               zephir_check_call_status();
+       }
        if (page < pages) {
                next = (page + 1);
        } else {
                next = pages;
        }
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_STRING(&_1, "next");
-       ZVAL_LONG(&_7, next);
-       ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_1, &_7);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_STRING(&_0, "next");
+       ZVAL_LONG(&_14, next);
+       ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_0, &_14);
        zephir_check_call_status();
        if (page > 1) {
                previous = (page - 1);
        } else {
                previous = 1;
        }
-       ZEPHIR_INIT_VAR(&_10);
-       zephir_create_array(&_10, 6, 0);
-       add_assoc_long_ex(&_10, SL("first"), 1);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_LONG(&_1, previous);
-       zephir_array_update_string(&_10, SL("previous"), &_1, PH_COPY | 
PH_SEPARATE);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_LONG(&_1, page);
-       zephir_array_update_string(&_10, SL("current"), &_1, PH_COPY | 
PH_SEPARATE);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_LONG(&_1, pages);
-       zephir_array_update_string(&_10, SL("last"), &_1, PH_COPY | 
PH_SEPARATE);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_LONG(&_1, pages);
-       zephir_array_update_string(&_10, SL("pages"), &_1, PH_COPY | 
PH_SEPARATE);
-       ZEPHIR_INIT_NVAR(&_1);
-       ZVAL_LONG(&_1, total);
-       zephir_array_update_string(&_10, SL("total"), &_1, PH_COPY | 
PH_SEPARATE);
-       ZEPHIR_CALL_METHOD(NULL, this_ptr, "replace", NULL, 0, &_10);
+       ZEPHIR_INIT_VAR(&_15);
+       zephir_create_array(&_15, 6, 0);
+       add_assoc_long_ex(&_15, SL("first"), 1);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_LONG(&_0, previous);
+       zephir_array_update_string(&_15, SL("previous"), &_0, PH_COPY | 
PH_SEPARATE);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_LONG(&_0, page);
+       zephir_array_update_string(&_15, SL("current"), &_0, PH_COPY | 
PH_SEPARATE);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_LONG(&_0, pages);
+       zephir_array_update_string(&_15, SL("last"), &_0, PH_COPY | 
PH_SEPARATE);
+       ZEPHIR_INIT_NVAR(&_0);
+       ZVAL_LONG(&_0, pages);
+       zephir_array_update_string(&_15, SL("pages"), &_0, PH_COPY | 
PH_SEPARATE);
+       zephir_array_update_string(&_15, SL("total"), &total, PH_COPY | 
PH_SEPARATE);
+       ZEPHIR_CALL_METHOD(NULL, this_ptr, "replace", NULL, 0, &_15);
        zephir_check_call_status();
        RETURN_THIS();
 
@@ -1064,7 +1083,7 @@
        ZEPHIR_CALL_METHOD(&_35, this_ptr, "preparebutton", &_34, 0, &_1, url, 
&_6);
        zephir_check_call_status();
        zephir_concat_self(&html, &_35);
-       zephir_is_iterable(&links, 0, "ice/pagination.zep", 320);
+       zephir_is_iterable(&links, 0, "ice/pagination.zep", 329);
        if (Z_TYPE_P(&links) == IS_ARRAY) {
                ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&links), _40, _41, _38)
                {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/ice/version.zep.c 
new/framework-1.6.2/build/php7/ice/version.zep.c
--- old/framework-1.6.1/build/php7/ice/version.zep.c    2020-05-10 
16:48:24.000000000 +0200
+++ new/framework-1.6.2/build/php7/ice/version.zep.c    2020-09-12 
08:36:18.000000000 +0200
@@ -48,7 +48,7 @@
 
        zephir_declare_class_constant_long(ice_version_ce, SL("MINOR"), 6);
 
-       zephir_declare_class_constant_long(ice_version_ce, SL("PATCH"), 1);
+       zephir_declare_class_constant_long(ice_version_ce, SL("PATCH"), 2);
 
        zephir_declare_class_constant_long(ice_version_ce, SL("STAGE"), 4);
 
@@ -71,7 +71,7 @@
        zephir_create_array(return_value, 5, 0);
        add_assoc_long_ex(return_value, SL("major"), 1);
        add_assoc_long_ex(return_value, SL("minor"), 6);
-       add_assoc_long_ex(return_value, SL("patch"), 1);
+       add_assoc_long_ex(return_value, SL("patch"), 2);
        add_assoc_long_ex(return_value, SL("stage"), 4);
        add_assoc_long_ex(return_value, SL("build"), 0);
        return;
@@ -153,7 +153,7 @@
        ZEPHIR_INIT_VAR(&_8);
        ZVAL_LONG(&_8, 6);
        ZEPHIR_INIT_VAR(&_9);
-       ZVAL_LONG(&_9, 1);
+       ZVAL_LONG(&_9, 2);
        ZEPHIR_CONCAT_VSVSVV(return_value, &_7, ".", &_8, ".", &_9, &suffix);
        RETURN_MM();
 
@@ -195,7 +195,7 @@
        zephir_check_call_status();
        ZEPHIR_INIT_NVAR(&_1);
        ZVAL_STRING(&_1, "%02s");
-       ZVAL_LONG(&_2, 1);
+       ZVAL_LONG(&_2, 2);
        ZEPHIR_CALL_FUNCTION(&_5, "sprintf", &_4, 11, &_1, &_2);
        zephir_check_call_status();
        ZEPHIR_INIT_VAR(&_6);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/build/php7/php_ice.h 
new/framework-1.6.2/build/php7/php_ice.h
--- old/framework-1.6.1/build/php7/php_ice.h    2020-05-10 16:48:24.000000000 
+0200
+++ new/framework-1.6.2/build/php7/php_ice.h    2020-09-12 08:36:18.000000000 
+0200
@@ -11,7 +11,7 @@
 #include "kernel/globals.h"
 
 #define PHP_ICE_NAME        "ice"
-#define PHP_ICE_VERSION     "1.6.1"
+#define PHP_ICE_VERSION     "1.6.2"
 #define PHP_ICE_EXTNAME     "ice"
 #define PHP_ICE_AUTHOR      "Ice Team"
 #define PHP_ICE_ZEPVERSION  "0.12.18-$Id$"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/config.json 
new/framework-1.6.2/config.json
--- old/framework-1.6.1/config.json     2020-05-10 16:48:24.000000000 +0200
+++ new/framework-1.6.2/config.json     2020-09-12 08:36:18.000000000 +0200
@@ -3,7 +3,7 @@
     "name": "ice",
     "description": "Simple and fast PHP framework delivered as 
C-extension.<br>Copyright (c) 2014-2020 Ice Team.",
     "author": "Ice Team",
-    "version": "1.6.1",
+    "version": "1.6.2",
     "verbose": false,
     "info": [
         {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/ice/mvc/model.zep 
new/framework-1.6.2/ice/mvc/model.zep
--- old/framework-1.6.1/ice/mvc/model.zep       2020-05-10 16:48:24.000000000 
+0200
+++ new/framework-1.6.2/ice/mvc/model.zep       2020-09-12 08:36:18.000000000 
+0200
@@ -547,6 +547,16 @@
     }
 
     /**
+     * Check whether model is loaded.
+     *
+     * @return boolean
+     */
+    public function loaded() -> boolean
+    {
+        return this->isLoaded ? true : false;
+    }
+
+    /**
      * Get the last Db error.
      *
      * @return mixed
@@ -707,7 +717,7 @@
                 let filters[referencedField] = this->{field},
                     result = create_instance_params(referenceModel, [filters, 
null, options]);
 
-                if !result->count() {
+                if !result->loaded() {
                     return false;
                 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/ice/mvc/url.zep 
new/framework-1.6.2/ice/mvc/url.zep
--- old/framework-1.6.1/ice/mvc/url.zep 2020-05-10 16:48:24.000000000 +0200
+++ new/framework-1.6.2/ice/mvc/url.zep 2020-09-12 08:36:18.000000000 +0200
@@ -25,7 +25,12 @@
      */
     public function getStatic(string uri = null) -> string
     {
-        return this->getStaticUri() . uri;
+        var staticUri;
+        let staticUri = rtrim(this->staticUri, "/");
+        if uri[0] != '/' {
+            let staticUri .= "/";
+        }
+        return staticUri . uri;
     }
 
     /**
@@ -38,37 +43,27 @@
      */
     public function get(var uri = null, var args = null, boolean local = true) 
-> string
     {
-        var baseUri, queryString;
+        var queryString;
 
-        if !local {
-            if typeof uri == "string" && (memstr(uri, "//") || memstr(uri, 
":")) {
-                if preg_match("#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i", uri) {
-                    let local = false;
-                } else {
-                    let local = true;
-                }
-            } else {
-                let local = true;
-            }
+        if !local && !empty uri {
+            let local = empty parse_url(uri, PHP_URL_HOST) && empty 
parse_url(uri, PHP_URL_SCHEME);
         }
 
-        let baseUri = this->getBaseUri();
-
         if local {
             // Get current URL if uri is false
             if uri === false && isset _GET["_url"] {
                 let uri = _GET["_url"];
             } else {
                 if !starts_with(uri, "#") && !starts_with(uri, "?")  {
-                    let uri = baseUri . uri;
+                    let uri = this->getBaseUri() . uri;
                 }
             }
         }
 
         if args {
             let queryString = http_build_query(args);
-            if typeof queryString == "string" && strlen(queryString) {
-                if strpos(queryString, "?") !== false {
+            if queryString {
+                if strpos(uri, "?") !== false {
                     let uri .= "&" . queryString;
                 } else {
                     let uri .= "?" . queryString;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/ice/pagination.zep 
new/framework-1.6.2/ice/pagination.zep
--- old/framework-1.6.1/ice/pagination.zep      2020-05-10 16:48:24.000000000 
+0200
+++ new/framework-1.6.2/ice/pagination.zep      2020-09-12 08:36:18.000000000 
+0200
@@ -39,24 +39,30 @@
      */
     public function calculate() -> <Pagination>
     {
-        var items, data;
-        int limit, page, pages, total, previous, next;
+        var items, data, total;
+        int limit, page, pages, previous, next;
 
-        let items  = this->get("data", []);
+        let total = this->get("total");
 
-        if typeof items != "array" && !(items instanceof Arr) {
-            throw new Exception("Invalid data for pagination");
-        }
+        if typeof total == "null" {
+            // No total number specified, we need to count items in data
+            let data  = this->get("data", []);
+
+            // Check if we can paginate the data
+            if typeof data == "object" && (data instanceof Arr) {
+                // Convert to array
+                let items = data->all();
+            } elseif typeof data == "array" {
+                let items = data;
+            } else {
+                throw new Exception("Invalid data for pagination");
+            }
 
-        if items instanceof Arr {
-            let data = items->all();
-        } else {
-            let data = items;
+            let total = count(items);
         }
 
         let limit  = (int) this->get("limit", 10),
             page = (int) this->get("page", 1),
-            total = count(items),
             pages = (int) ceil(total / intval(limit ? limit : 1));
 
         // Make sure page is >= 1
@@ -64,7 +70,10 @@
             let page = 1;
         }
 
-        this->set("items", array_slice(data, limit * (page - 1), limit));
+        if !this->has("items") && items {
+            // Set items on the current page only
+            this->set("items", array_slice(items, limit * (page - 1), limit));
+        }
 
         if page < pages {
             let next = page + 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/ice/version.zep 
new/framework-1.6.2/ice/version.zep
--- old/framework-1.6.1/ice/version.zep 2020-05-10 16:48:24.000000000 +0200
+++ new/framework-1.6.2/ice/version.zep 2020-09-12 08:36:18.000000000 +0200
@@ -21,7 +21,7 @@
     // Don't forget to update config.json and run zephir fullclean
     const MAJOR = 1;
     const MINOR = 6;
-    const PATCH = 1;
+    const PATCH = 2;
     const STAGE = self::STABLE;
     const BUILD = 0;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/framework-1.6.1/tests/UrlTest.php 
new/framework-1.6.2/tests/UrlTest.php
--- old/framework-1.6.1/tests/UrlTest.php       1970-01-01 01:00:00.000000000 
+0100
+++ new/framework-1.6.2/tests/UrlTest.php       2020-09-12 08:36:18.000000000 
+0200
@@ -0,0 +1,70 @@
+<?php
+
+namespace Tests;
+
+use PHPUnit_Framework_TestCase as PHPUnit;
+use Ice\Mvc\Url;
+
+class UrlTest extends PHPUnit
+{
+    private static $url;
+
+    public static function setUpBeforeClass()
+    {
+        self::$url = new Url();
+    }
+
+    public static function tearDownAfterClass()
+    {
+        self::$url = null;
+    }
+
+    /**
+    * @dataProvider staticUrls
+    */
+    public function testGetStatic($uri, $expected, $static = '/')
+    {
+        self::$url->setStaticUri($static);
+        $this->assertEquals(self::$url->getStatic($uri), $expected);
+    }
+
+
+    public function staticUrls()
+    {
+        yield ['style.css', '/style.css'];
+        yield ['/style.css', '/style.css'];
+        yield ['style.css', 'https://www.iceframework.org/style.css', 
'https://www.iceframework.org/'];
+        yield ['/style.css', 'https://www.iceframework.org/style.css', 
'https://www.iceframework.org/'];
+    }
+
+    /**
+     * @dataProvider urls
+     */
+    public function testGet($args, $expected, $base = '/')
+    {
+        self::$url->setBaseUri($base);
+        $this->assertEquals(self::$url->get(...$args), $expected);
+    }
+
+    public function urls()
+    {
+        yield [[null, [], true], '/'];
+        yield [[null, [], true], '/blog/', '/blog/'];
+
+        yield [['about-us', [], true], '/about-us',];
+        yield [['about-us', [], true], '/blog/about-us',  '/blog/'];
+
+        yield [['search', ['k' => 'v'], true], '/search?k=v'];
+        yield [['search?v=1.0', ['k' => 'v'], true], '/search?v=1.0&k=v'];
+
+        yield [['https://example.com/about-us', [], false], 
'https://example.com/about-us'];
+        yield [['https://example.com/about-us', ['k' => 'v'], false], 
'https://example.com/about-us?k=v'];
+
+        yield [['//google.com', [], false], '//google.com'];
+        yield [['#javascript', [], false], '#javascript'];
+        yield [['?query-string', [], false], '?query-string'];
+
+        yield [['mailto:[email protected]', [], false], 
'mailto:[email protected]'];
+        yield [['skype:iceframework', [], false], 'skype:iceframework'];
+    }
+}


Reply via email to