mirror of
https://github.com/php/php-src.git
synced 2026-04-26 09:28:21 +02:00
Throw exception for unconstructed intl objects
Closes GH-5052
This commit is contained in:
@@ -58,8 +58,8 @@ static inline BreakIterator_object *php_intl_breakiterator_fetch_object(zend_obj
|
||||
BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (bio->biter == NULL) \
|
||||
{ \
|
||||
intl_errors_set(&bio->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed BreakIterator", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed BreakIterator"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
void breakiterator_object_create(zval *object, BreakIterator *break_iter, int brand_new);
|
||||
|
||||
@@ -55,8 +55,8 @@ static inline Calendar_object *php_intl_calendar_fetch_object(zend_object *obj)
|
||||
CALENDAR_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (co->ucal == NULL) \
|
||||
{ \
|
||||
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlCalendar", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed IntlCalendar"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
void calendar_object_create(zval *object, Calendar *calendar);
|
||||
|
||||
@@ -41,8 +41,8 @@ extern "C" {
|
||||
object = ZEND_THIS; \
|
||||
INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (ii->iterator == NULL) { \
|
||||
intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed IntlIterator"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -46,8 +46,8 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr;
|
||||
DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (dfo->datef_data.udatf == NULL) \
|
||||
{ \
|
||||
intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed IntlDateFormatter"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
#define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf
|
||||
|
||||
@@ -44,9 +44,8 @@ extern zend_class_entry *NumberFormatter_ce_ptr;
|
||||
FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (FORMATTER_OBJECT(nfo) == NULL) \
|
||||
{ \
|
||||
intl_errors_set(&nfo->nf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Found unconstructed NumberFormatter", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed NumberFormatter"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr;
|
||||
#define MSG_FORMAT_METHOD_FETCH_OBJECT \
|
||||
MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (MSG_FORMAT_OBJECT(mfo) == NULL) { \
|
||||
intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Found unconstructed MessageFormatter", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed MessageFormatter"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
#define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf
|
||||
|
||||
@@ -13,7 +13,7 @@ class ResourceBundle implements Traversable
|
||||
*/
|
||||
public function get($index, bool $fallback = true) {}
|
||||
|
||||
/** @return int|false */
|
||||
/** @return int */
|
||||
public function count() {}
|
||||
|
||||
/** @return array|false */
|
||||
@@ -34,7 +34,7 @@ function resourcebundle_create(?string $locale, ?string $bundlename, bool $fallb
|
||||
*/
|
||||
function resourcebundle_get(ResourceBundle $bundle, $index) {}
|
||||
|
||||
function resourcebundle_count(ResourceBundle $bundle): int|false {}
|
||||
function resourcebundle_count(ResourceBundle $bundle): int {}
|
||||
|
||||
function resourcebundle_locales(string $bundlename): array|false {}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_get, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, index)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_resourcebundle_count, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_count, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -43,9 +43,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_resourcebundle_locales, 0, 1, MA
|
||||
ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_get_error_code, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#define arginfo_resourcebundle_get_error_code arginfo_resourcebundle_count
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_get_error_message, 0, 1, IS_STRING, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
|
||||
|
||||
@@ -38,14 +38,12 @@ static inline ResourceBundle_object *php_intl_resourcebundle_fetch_object(zend_o
|
||||
#define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb)
|
||||
#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb)
|
||||
#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \
|
||||
INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb); \
|
||||
INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb); \
|
||||
if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \
|
||||
intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Found unconstructed ResourceBundle", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed ResourceBundle"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
|
||||
#define RESOURCEBUNDLE_OBJECT(rb) (rb)->me
|
||||
|
||||
void resourcebundle_register_class( void );
|
||||
|
||||
@@ -10,14 +10,14 @@ class Spoofchecker
|
||||
/** @return bool */
|
||||
public function areConfusable(string $s1, string $s2, &$error = null) {}
|
||||
|
||||
/** @return null|false */
|
||||
/** @return void */
|
||||
public function setAllowedLocales(string $locale_list) {}
|
||||
|
||||
/** @return null|false */
|
||||
/** @return void */
|
||||
public function setChecks(int $checks) {}
|
||||
|
||||
#if U_ICU_VERSION_MAJOR_NUM >= 58
|
||||
/** @return null|false */
|
||||
/** @return void */
|
||||
public function setRestrictionLevel(int $level) {}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -63,9 +63,8 @@ extern zend_class_entry *Spoofchecker_ce_ptr;
|
||||
#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
|
||||
SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (co->uspoof == NULL) { \
|
||||
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Found unconstructed Spoofchecker", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed Spoofchecker"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
// Macro to check return value of a ucol_* function call.
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeDoubleIntl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeDoubleIntl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(3) "1.1"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeDoubleIntl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,10 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeDoubleIntl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
@@ -27,4 +28,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.10"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -31,11 +31,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -46,4 +46,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -15,11 +15,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -30,4 +30,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
[0]=>
|
||||
@@ -29,4 +29,4 @@ array(4) {
|
||||
[3]=>
|
||||
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
[0]=>
|
||||
@@ -29,4 +29,4 @@ array(4) {
|
||||
[3]=>
|
||||
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-214748
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt32Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(4) {
|
||||
[0]=>
|
||||
@@ -29,4 +29,4 @@ array(4) {
|
||||
[3]=>
|
||||
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(1) "1"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(13) "2,147,483,648"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-214748
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(14) "-2,147,483,649"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.10000
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(7) "SFD1.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(19) "SFD2,147,483,648.00"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -12,11 +12,11 @@ $unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-214748
|
||||
var_dump($unit_test_args);
|
||||
|
||||
// execute the code from #testFormatTypeInt64Intl
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
|
||||
echo "== didn't crash ==".PHP_EOL;
|
||||
|
||||
?>
|
||||
try {
|
||||
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
|
||||
} catch (Error $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
@@ -27,4 +27,4 @@ array(3) {
|
||||
[2]=>
|
||||
string(21) "(SFD2,147,483,649.00)"
|
||||
}
|
||||
== didn't crash ==
|
||||
Found unconstructed NumberFormatter
|
||||
|
||||
@@ -31,7 +31,7 @@ class IntlTimeZone
|
||||
/** @return string|false */
|
||||
public function getDisplayName(bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null) {}
|
||||
|
||||
/** @return int|false */
|
||||
/** @return int */
|
||||
public function getDSTSavings() {}
|
||||
|
||||
/** @return string|false */
|
||||
@@ -52,7 +52,7 @@ class IntlTimeZone
|
||||
/** @return bool */
|
||||
public function getOffset(float $date, bool $local, &$rawOffset, &$dstOffset) {}
|
||||
|
||||
/** @return int|false */
|
||||
/** @return int */
|
||||
public function getRawOffset() {}
|
||||
|
||||
/** @return string|false */
|
||||
@@ -101,7 +101,7 @@ function intltz_get_canonical_id(string $zoneId, &$isSystemID = null): string|fa
|
||||
|
||||
function intltz_get_display_name(IntlTimeZone $tz, bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null): string|false {}
|
||||
|
||||
function intltz_get_dst_savings(IntlTimeZone $tz): int|false {}
|
||||
function intltz_get_dst_savings(IntlTimeZone $tz): int {}
|
||||
|
||||
function intltz_get_equivalent_id(string $zoneId, int $index): string|false {}
|
||||
|
||||
@@ -115,7 +115,7 @@ function intltz_get_id(IntlTimeZone $tz): string|false {}
|
||||
|
||||
function intltz_get_offset(IntlTimeZone $tz, float $date, bool $local, &$rawOffset, &$dstOffset): bool {}
|
||||
|
||||
function intltz_get_raw_offset(IntlTimeZone $tz): int|false {}
|
||||
function intltz_get_raw_offset(IntlTimeZone $tz): int {}
|
||||
|
||||
function intltz_get_region(string $zoneId): string|false {}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_display_name, 0, 1, M
|
||||
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_dst_savings, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_get_dst_savings, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@@ -131,7 +131,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_equivalent_id, 0, 2,
|
||||
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_intltz_get_error_code arginfo_intltz_get_dst_savings
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_error_code, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
|
||||
ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
|
||||
|
||||
@@ -60,8 +60,8 @@ static inline TimeZone_object *php_intl_timezone_fetch_object(zend_object *obj)
|
||||
#define TIMEZONE_METHOD_FETCH_OBJECT\
|
||||
TIMEZONE_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if (to->utimezone == NULL) { \
|
||||
intl_errors_set(&to->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlTimeZone", 0); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed IntlTimeZone"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, intl_error *outside_error, const char *func, zval *ret);
|
||||
|
||||
@@ -52,8 +52,8 @@ static inline Transliterator_object *php_intl_transliterator_fetch_object(zend_o
|
||||
TRANSLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
|
||||
if( to->utrans == NULL ) \
|
||||
{ \
|
||||
intl_errors_set( &to->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed transliterator", 0 ); \
|
||||
RETURN_FALSE; \
|
||||
zend_throw_error(NULL, "Found unconstructed transliterator"); \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
int transliterator_object_construct( zval *object,
|
||||
|
||||
Reference in New Issue
Block a user