From db97feb9bfa7c43473efa9c9931d72adf48f4b2f Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 21 Jun 2018 20:35:50 -0400 Subject: [PATCH 1/2] Fixed invalid call to ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX for PHP 7.2+ on box.c --- classes/box.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/box.c b/classes/box.c index e1b60d9..7ff6ae1 100644 --- a/classes/box.c +++ b/classes/box.c @@ -185,7 +185,7 @@ PHP_METHOD(Box, setPadded) } /* }}} */ #if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, 0) #else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0) #endif From ec48c11f51b92d640f7fce5fd724145c864555f7 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 21 Jun 2018 22:06:52 -0400 Subject: [PATCH 2/2] Added missing throw of exceptions. --- classes/box.c | 2 +- classes/entry.c | 3 ++- classes/font.c | 3 ++- classes/menu.c | 11 ++++++----- classes/multi.c | 3 ++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/classes/box.c b/classes/box.c index 7ff6ae1..1f77c58 100644 --- a/classes/box.c +++ b/classes/box.c @@ -79,7 +79,7 @@ PHP_METHOD(Box, __construct) break; default: - { /* throw */ } + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$orientation'"); } } /* }}} */ diff --git a/classes/entry.c b/classes/entry.c index ef4443e..655832f 100644 --- a/classes/entry.c +++ b/classes/entry.c @@ -23,6 +23,7 @@ #include #include +#include zend_object_handlers php_ui_entry_handlers; @@ -94,7 +95,7 @@ PHP_METHOD(Entry, __construct) break; default: - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } diff --git a/classes/font.c b/classes/font.c index 633e676..128def0 100644 --- a/classes/font.c +++ b/classes/font.c @@ -23,6 +23,7 @@ #include #include +#include zend_object_handlers php_ui_font_handlers; @@ -85,7 +86,7 @@ PHP_METHOD(DrawTextFont, __construct) font->f = uiDrawLoadClosestFont(&d->d); if (!font->f) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid font descriptor"); } } /* }}} */ diff --git a/classes/menu.c b/classes/menu.c index 2439e2d..b998bf5 100644 --- a/classes/menu.c +++ b/classes/menu.c @@ -23,6 +23,7 @@ #include #include +#include zend_object_handlers php_ui_menu_handlers; @@ -82,7 +83,7 @@ PHP_METHOD(Menu, append) } if (ZEND_NUM_ARGS() > 1 && !instanceof_function(type, uiItem_ce)) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } @@ -108,7 +109,7 @@ PHP_METHOD(Menu, appendCheck) } if (ZEND_NUM_ARGS() > 1 && !instanceof_function(type, uiItem_ce)) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } @@ -139,7 +140,7 @@ PHP_METHOD(Menu, appendQuit) } if (ZEND_NUM_ARGS() > 1 && !instanceof_function(type, uiItem_ce)) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } @@ -162,7 +163,7 @@ PHP_METHOD(Menu, appendPreferences) } if (ZEND_NUM_ARGS() > 1 && !instanceof_function(type, uiItem_ce)) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } @@ -185,7 +186,7 @@ PHP_METHOD(Menu, appendAbout) } if (ZEND_NUM_ARGS() > 1 && !instanceof_function(type, uiItem_ce)) { - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; } diff --git a/classes/multi.c b/classes/multi.c index 4accfba..ebdf334 100644 --- a/classes/multi.c +++ b/classes/multi.c @@ -23,6 +23,7 @@ #include #include +#include zend_object_handlers php_ui_multi_handlers; @@ -90,7 +91,7 @@ PHP_METHOD(Multi, __construct) break; default: - /* throw */ + php_ui_exception_ex(InvalidArgumentException, "Invalid value given for '$type'"); return; }