com php-src: Add warnings when counting invalid parameters: ext/standard/array.c
| From: | Joe Watkins | Date: | Thu, 17 Nov 2016 09:33:04 +0000 |
| Subject: | com php-src: Add warnings when counting invalid parameters: ext/standard/array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95823@lists.php.net to get a copy of this message | ||
Commit: aaf7341b1ce6889387b4dcdf5a9b04a651076bc6
Author: Craig Duncan <git@duncanc.co.uk> Tue, 4 Oct 2016 13:27:02 +0100
Committer: Joe Watkins <krakjoe@php.net> Thu, 17 Nov 2016 09:33:04 +0000
Parents: d0bdf19eb48f4d1c23b78cb58d2f65d0bc2b6f49
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aaf7341b1ce6889387b4dcdf5a9b04a651076bc6
Log:
Add warnings when counting invalid parameters
Changed paths:
M ext/standard/array.c
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index f3a7f4d...2c51149 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -790,6 +790,7 @@ PHP_FUNCTION(count)
switch (Z_TYPE_P(array)) {
case IS_NULL:
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements
Countable");
RETURN_LONG(0);
break;
case IS_ARRAY:
@@ -820,8 +821,14 @@ PHP_FUNCTION(count)
}
return;
}
+
+ /* If There's no handler and it doesn't implement Countable then add a warning */
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements
Countable");
+ RETURN_LONG(1);
+ break;
}
default:
+ php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements
Countable");
RETURN_LONG(1);
break;
}