Re: GMP object and is_scalar()

From: Date: Sun, 29 Dec 2013 19:33:43 +0000
Subject: Re: GMP object and is_scalar()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-70909@lists.php.net to get a copy of this message
On Sun, Dec 29, 2013 at 11:26 AM, Hannes Magnusson
<hannes.magnusson@gmail.com> wrote:
> On Sun, Dec 29, 2013 at 9:54 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
>> On Sun, Dec 29, 2013 at 9:09 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>>
>>> Hi all,
>>>
>>> GMP object is object. Therefore, is_scalar() returns false for GMP
>>> objects.
>>>
>>> [yohgaki@dev php-src]$ ./php-bin -r '$v = gmp_init("0");
>>> var_dump(gettype($v));'
>>> string(6) "object"
>>> [yohgaki@dev php-src]$ ./php-bin -r '$v = gmp_init("0");
>>> var_dump(is_scalar($v));'
>>> bool(false)
>>>
>>> This is correct behavior, but this behavior is debatable, IMO.
>>>
>>> Any comments?
>>>
>>
>> Sorry, I don't understand what you're saying. Why would is_scalar return
>> true for an **object**?
>
>
> Its not even an object, its a resource.
>
> I think you are completely off path here Yasuo, same with your empty() thread.
> That just doesn't make sense.


Waiiit a minute. It is a object in current master?

That will break code that makes sure gmp_init() worked by doing
is_resource() on the return value.

-Hannes


Thread (17 messages)

« previous php.internals (#70909) next »