com php-src: Return -1 seems bug here: ext/dba/dba.c
| From: | Xinchen Hui | Date: | Thu, 10 Dec 2015 09:35:35 +0000 |
| Subject: | com php-src: Return -1 seems bug here: ext/dba/dba.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90199@lists.php.net to get a copy of this message | ||
Commit: e4ad9ed8adac91ad62c8245615e5d74e35944dff
Author: Xinchen Hui <laruence@gmail.com> Thu, 10 Dec 2015 17:35:35 +0800
Parents: e2e39f3bfc67a70d58f82fc720e8746c32775c85
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e4ad9ed8adac91ad62c8245615e5d74e35944dff
Log:
Return -1 seems bug here
Changed paths:
M ext/dba/dba.c
Diff:
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 0241333..6dd3e6d 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -209,7 +209,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) {
php_error_docref(NULL, E_RECOVERABLE_ERROR, "Key does not have exactly two elements: (key,
name)");
- return -1;
+ return 0;
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos);
group = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos);
@@ -233,7 +233,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
convert_to_string(&tmp);
len = Z_STRLEN(tmp);
- if (Z_STRLEN(tmp)) {
+ if (len) {
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
}
zval_ptr_dtor(&tmp);