Re: signed long hash index for PHP7?

From: Date: Wed, 30 Jul 2014 05:01:06 +0000
Subject: Re: signed long hash index for PHP7?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-76260@lists.php.net to get a copy of this message
Hi,


On Wed, Jul 30, 2014 at 10:37 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:

> Hi all,
>
> Current Zend hash uses ulong for numeric array indexes.
> This causes bug #67693
>
> https://bugs.php.net/bug.php?id=67693
>
> Signed/unsigned mismatch is the root cause of this bug.
> Since PHP's int is signed by default, it might be better
> to change Zend hash index to signed long.
>

Instead of doing that, why not simply disallow negative array indices to be
used as integers?

In other words, negative indices are treated as if you had used strings so
that it doesn't upset the the last numeric index kept in the array
structure.

From what I can tell, it should be a pretty simply patch.

Thoughts?


>
> I would like to hear comments who understand Zend internals. If there
> aren't
> issues, we may have signed long index for PHP7.
>
> I also would like to hear comments for possible fix in released versions.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net
>



-- 
--
Tjerk


Thread (7 messages)

« previous php.internals (#76260) next »