/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/gmp/tests/overloading_with_object_stringable.phpt
91 строка
2 KB
Gina Peter Banyard
ext/gmp: Fix segfault when null is encountered on an overloaded operator
02 ноя 2024, 20:36
Не верифицирован
02 ноя 2024, 20:36
5253647
Код
Авторство
О чём код?
--TEST-- GMP operator overloading does not support stringable objects --EXTENSIONS-- gmp --FILE-- <?php class T { public function __toString() { return "42"; } } $num = gmp_init(42); $o = new T(); try { var_dump($num + $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num - $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num * $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num / $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num % $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num ** $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num | $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num & $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num ^ $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num << $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump($num >> $o); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Unsupported operand types: GMP ** T TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Number must be of type GMP|string|int, T given TypeError: Unsupported operand types: GMP << T TypeError: Unsupported operand types: GMP >> T