summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Faulds <ajf@ajf.me>2015-02-01 16:40:57 +0000
committerAndrea Faulds <ajf@ajf.me>2015-02-10 15:48:09 +0000
commit44ed070a9afed6f45165769f959c1122e765ad35 (patch)
tree792db75fbfc7da013537341917ebd75257ecc706
parent6b6b2b4b7cc2f463c7add85fd1ccd1ba89b004cf (diff)
downloadphp-git-44ed070a9afed6f45165769f959c1122e765ad35.tar.gz
Fix Gd usages of ZEND_WRONG_PARAM_COUNT, add usage note
-rw-r--r--Zend/zend_API.h11
-rw-r--r--ext/gd/gd.c6
2 files changed, 10 insertions, 7 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 0855f811dc..4f12834bcf 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -353,12 +353,15 @@ ZEND_API char *zend_get_type_by_const(int type);
#define getThis() (Z_OBJ(EX(This)) ? &EX(This) : NULL)
#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
-#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT((ZEND_CALL_INFO(EG(current_execute_data)) & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0)
-#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL((ZEND_CALL_INFO(EG(current_execute_data)) & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0, ret)
+#define WRONG_PARAM_COUNT _ZEND_WRONG_PARAM_COUNT((ZEND_CALL_INFO(EG(current_execute_data)) & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0)
+#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) _ZEND_WRONG_PARAM_COUNT_WITH_RETVAL((ZEND_CALL_INFO(EG(current_execute_data)) & ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0, ret)
#define ARG_COUNT(dummy) EX_NUM_ARGS()
#define ZEND_NUM_ARGS() EX_NUM_ARGS()
-#define ZEND_WRONG_PARAM_COUNT(strict) { _zend_wrong_param_count(strict); return; }
-#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(strict, ret) { _zend_wrong_param_count(strict); return ret; }
+/* These are prefixed with underscores for a reason: don't use them directly
+ * Use WRONG_PARAM_COUNT;
+ */
+#define _ZEND_WRONG_PARAM_COUNT(strict) { _zend_wrong_param_count(strict); return; }
+#define _ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(strict, ret) { _zend_wrong_param_count(strict); return ret; }
#ifndef ZEND_WIN32
#define DLEXPORT
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 61050ba288..ebd4500495 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -3940,13 +3940,13 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
if (mode == TTFTEXT_BBOX) {
if (argc < 4 || argc > ((extended) ? 5 : 4)) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
} else if (zend_parse_parameters(argc, "ddss|a", &ptsize, &angle, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
RETURN_FALSE;
}
} else {
if (argc < 8 || argc > ((extended) ? 9 : 8)) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
} else if (zend_parse_parameters(argc, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
RETURN_FALSE;
}
@@ -4395,7 +4395,7 @@ PHP_FUNCTION(imagepsbbox)
BBox char_bbox, str_bbox = {0, 0, 0, 0};
if (argc != 3 && argc != 6) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Srl|lld", &str, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {