Re: GMP and empty()
Hi,
because in my world the following operations should be the same:
(expect that "empty" doesn't trigger a warning in an unknown variable)
$v = gmp_init("0");
if (!$v) {}
if ($v != true) {}
if ($v == false) {}
if (empty($v)) {}
... so in my world "empty" should be handled the same as "$v == false"
and such comparison operation is possible to define by the GMP object if
it's not already.
Thoughts?
Marc
Am 29.12.2013 09:04, schrieb Yasuo Ohgaki:
> Hi all,
>
> GMP '0' object does not evaluated as empty()
>
> $ ./php-bin -r '$v = gmp_init("0"); var_dump(empty($v), $v == 0);'
> bool(false)
> bool(true)
>
> This may cause confusion and bugs in user scripts.
>
> Most math functions does not work with GMP object neither.
> We might be better to raise warning for math functions that
> do not support GMP object.
>
> Regards,
>
> --
> Yasuo Ohgaki
> [email protected]
>
Thread (13 messages)