cppcheck & 7.1RC tests
authorMichael Wallner <mike@php.net>
Wed, 21 Sep 2016 12:31:35 +0000 (14:31 +0200)
committerMichael Wallner <mike@php.net>
Wed, 21 Sep 2016 12:31:35 +0000 (14:31 +0200)
.travis.yml
scripts/gen_travis_yml.php
src/php_http_client_curl_user.c
src/php_http_info.c
src/php_http_querystring.c
travis/pecl

index 78dbc23ed26061b1c7829ff7ac680a3e6cc6e768..d371e67b45ec95d68ba2e0d130c6c22d42e9a25b 100644 (file)
@@ -10,23 +10,32 @@ addons:
    - zlib1g-dev
    - libidn11-dev
    - libevent-dev
+   - cppcheck
 
 env:
  - PHP=7.0 enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=no enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=yes enable_maintainer_zts=no enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=no enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=yes enable_maintainer_zts=yes enable_json=no enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=no enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=yes enable_maintainer_zts=no enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=no enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=7.0 enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
+ - PHP=7.1 enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
  - PHP=master enable_debug=yes enable_maintainer_zts=yes enable_json=yes enable_hash=yes enable_iconv=yes
 # once with gcov
  - CFLAGS="-O0 -g --coverage" CXXFLAGS="-O0 -g --coverage" PHP=master enable_json=yes enable_hash=yes enable_iconv=yes 
@@ -39,6 +48,7 @@ before_script:
 
 script:
  - make -f travis/pecl/Makefile test
+ - make -f travis/pecl/Makefile cppcheck
 
 after_failure:
  - test -e tests/helper/server.log && cat tests/helper/server.log
index 213c5f46ed3127b121109d3053b6a599ba6b1363..852fce96697d235d8b649e3be07f55c4de563810 100755 (executable)
@@ -11,13 +11,14 @@ addons:
    - zlib1g-dev
    - libidn11-dev
    - libevent-dev
+   - cppcheck
 
 env:
 <?php
 
 $gen = include "./travis/pecl/gen-matrix.php";
 $env = $gen([
-       "PHP" => ["7.0", "master"],
+       "PHP" => ["7.0", "7.1", "master"],
        "enable_debug",
        "enable_maintainer_zts",
        "enable_json",
@@ -40,6 +41,7 @@ before_script:
 
 script:
  - make -f travis/pecl/Makefile test
+ - make -f travis/pecl/Makefile cppcheck
 
 after_failure:
  - test -e tests/helper/server.log && cat tests/helper/server.log
index d345e27e96bc30b2d7c985038073a011b885b9e5..a0449a2f27374d0b6f06813189cc2f47f6175351 100644 (file)
@@ -59,7 +59,7 @@ static void php_http_client_curl_user_timer(CURLM *multi, long timeout_ms, void
 
        if (timeout_ms <= 0) {
                php_http_client_curl_loop(context->client, CURL_SOCKET_TIMEOUT, 0);
-       } else if (timeout_ms > 0) {
+       } else {
                zval args[1], *ztimeout = &args[0];
 
                ZVAL_LONG(ztimeout, timeout_ms);
index cbaee88490c17421a7c618f7653ed2c6c8c819bc..1470f976e2b554f4cd193732a25ee6a6cea2ac3c 100644 (file)
@@ -74,11 +74,12 @@ void php_http_info_to_string(php_http_info_t *info, char **str, size_t *len, con
                                info->http.info.request.method&&!strcasecmp(info->http.info.request.method,"CONNECT")?(
                                info->http.info.request.url?php_http_url_authority_to_string(info->http.info.request.url, &(tmp), NULL):"0"):(
                                info->http.info.request.url?php_http_url_to_string(info->http.info.request.url, &(tmp), NULL, 0):"/"),
-                               info->http.version.major||info->http.version.major?info->http.version.major:1,
+                               info->http.version.major||info->http.version.minor?info->http.version.major:1,
                                info->http.version.major||info->http.version.minor?info->http.version.minor:1,
                                eol);
        } else if (info->type == PHP_HTTP_RESPONSE){
-               *len = spprintf(str, 0, "HTTP/%u.%u %d%s%s%s", info->http.version.major||info->http.version.major?info->http.version.major:1,
+               *len = spprintf(str, 0, "HTTP/%u.%u %d%s%s%s",
+                               info->http.version.major||info->http.version.minor?info->http.version.major:1,
                                info->http.version.major||info->http.version.minor?info->http.version.minor:1,
                                info->http.info.response.code?info->http.info.response.code:200,
                                info->http.info.response.status&&*info->http.info.response.status ? " ":"",
index dfda3d5e935c0ac74f6b392effb4c45b4379b0a0..01d95f9f0ec91bd210fd2b15335a4fecc3cffac0 100644 (file)
@@ -160,7 +160,7 @@ static int apply_querystring(zval *val)
                zval *zvalue;
 
                if ((zvalue = zend_hash_str_find(Z_ARRVAL_P(val), ZEND_STRL("value")))) {
-                       zval tmp;
+                       zval tmp = {0};
 
                        ZVAL_COPY(&tmp, zvalue);
                        zval_dtor(val);
@@ -289,25 +289,24 @@ ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *o
                                        /*
                                         * update
                                         */
-                                       zval equal, tmp, *entry = &tmp;
+                                       zval equal, tmp, *entry = NULL;
 
                                        ZVAL_UNDEF(&tmp);
                                        /* recursive */
                                        if (Z_TYPE_P(params_entry) == IS_ARRAY || Z_TYPE_P(params_entry) == IS_OBJECT) {
-                                               ZVAL_DUP(entry, qarray_entry);
-                                               convert_to_array(entry);
-                                               php_http_querystring_update(entry, params_entry, NULL);
+                                               ZVAL_DUP(&tmp, qarray_entry);
+                                               convert_to_array(&tmp);
+                                               php_http_querystring_update(&tmp, params_entry, NULL);
+                                               entry = &tmp;
                                        } else if ((FAILURE == is_identical_function(&equal, qarray_entry, params_entry)) || Z_TYPE(equal) != IS_TRUE) {
                                                Z_TRY_ADDREF_P(params_entry);
                                                entry = params_entry;
                                        }
 
-                                       if (entry) {
-                                               if (key.key) {
-                                                       zend_hash_update(Z_ARRVAL_P(qarray), key.key, entry);
-                                               } else {
-                                                       zend_hash_index_update(Z_ARRVAL_P(qarray), key.h, entry);
-                                               }
+                                       if (key.key) {
+                                               zend_hash_update(Z_ARRVAL_P(qarray), key.key, entry ? entry : &tmp);
+                                       } else {
+                                               zend_hash_index_update(Z_ARRVAL_P(qarray), key.h, entry ? entry : &tmp);
                                        }
                                } else {
                                        zval entry, *entry_ptr = &entry;
index 2d06b8b6eba14eb26f4e6b5d0eac19569ef1611c..a2206d5f2eaf963d37ff568dd17cd6435f00f809 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2d06b8b6eba14eb26f4e6b5d0eac19569ef1611c
+Subproject commit a2206d5f2eaf963d37ff568dd17cd6435f00f809