# PATCH: bug #46701

- Thread: https://externals.io/message/42456
- Original archive: https://news-web.php.net/php.internals/42456
- Started by shire on 2009-01-03T05:03:06+00:00
- Messages: 10
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #42456 — shire — 2009-01-03T05:03:06+00:00

URL: https://externals.io/message/42456#42456

I've created a patch for bug #46701 (http://bugs.php.net/bug.php?id=46701) but it requires Zend changes, it can be found at the links below for all branches.  I've verified all tests pass.  We may want to verify it for other architectures due to the nature of it being a float conversion problem, I tested on Intel OS X 10.5.5.  But this should at least be equivalent to $array[intval($double)] now.


http://tekrat.com/patches/bug46701.php6.patch
http://tekrat.com/patches/bug46701.php53.patch
http://tekrat.com/patches/bug46701.php52.patch


Thanks,
-shire

---

## #42457 — Felipe Pena — 2009-01-03T12:27:03+00:00

URL: https://externals.io/message/42456#42457 · In reply to: #42456

Em Sex, 2009-01-02 às 21:03 -0800, shire escreveu:
> I've created a patch for bug #46701 (http://bugs.php.net/bug.php?id=46701) but it requires Zend changes, it can be found at the links below for all branches.  I've verified all tests pass.  We may want to verify it for other architectures due to the nature of it being a float conversion problem, I tested on Intel OS X 10.5.5.  But this should at least be equivalent to $array[intval($double)] now.
> 
> 
> http://tekrat.com/patches/bug46701.php6.patch
> http://tekrat.com/patches/bug46701.php53.patch
> http://tekrat.com/patches/bug46701.php52.patch
> 
> 

I suppose that should we also change the fetch (ZEND_FETCH_DIM_*)?

And probably:
		case IS_DOUBLE:
			index = (long)Z_DVAL_P(dim);
			goto num_index;

And zend_execute.c (zend_fetch_dimension_address_inner) will be
superfluous with this change.


> Thanks,
> -shire
> 
-- 
Regards,
Felipe Pena

---

## #42458 — Felipe Pena — 2009-01-03T12:31:30+00:00

URL: https://externals.io/message/42456#42458 · In reply to: #42457

Em Sáb, 2009-01-03 às 10:27 -0200, Felipe Pena escreveu:
> Em Sex, 2009-01-02 às 21:03 -0800, shire escreveu:
> > […]
> 
> I suppose that should we also change the fetch (ZEND_FETCH_DIM_*)?
> 
> And probably:
> 		case IS_DOUBLE:
> 			index = (long)Z_DVAL_P(dim);
> 			goto num_index;
> 
> And zend_execute.c (zend_fetch_dimension_address_inner) will be
> superfluous with this change.

Errr, I mean, the case IS_DOUBLE stuff in
zend_fetch_dimension_address_inner will be superfluous.

> 
> 
> > […]
-- 
Regards,
Felipe Pena

---

## #42459 — Felipe Pena — 2009-01-03T13:13:41+00:00

URL: https://externals.io/message/42456#42459 · In reply to: #42458

Em Sáb, 2009-01-03 às 10:31 -0200, Felipe Pena escreveu:
> Em Sáb, 2009-01-03 às 10:27 -0200, Felipe Pena escreveu:
> > […]
> 
> Errr, I mean, the case IS_DOUBLE stuff in
> zend_fetch_dimension_address_inner will be superfluous.
> 


In the end, I see that it requires the macro too, hehe.
So, a little change in your patch:

-		case IS_DOUBLE:
-			index = (long)Z_DVAL_P(dim);
+		case IS_DOUBLE: {
+			DVAL_TO_LVAL(Z_DVAL_P(dim), index);
 			goto num_index;
-
+		}


http://felipe.ath.cx/diff/shire-patch-change-46701-5_3.diff


> > […]
-- 
Regards,
Felipe Pena

---

## #42466 — shire — 2009-01-03T19:20:05+00:00

URL: https://externals.io/message/42456#42466 · In reply to: #42459

Felipe Pena wrote:
> Em Sáb, 2009-01-03 às 10:31 -0200, Felipe Pena escreveu:
> > […]
>
>
> In the end, I see that it requires the macro too, hehe.
> So, a little change in your patch:
>
> -		case IS_DOUBLE:
> -			index = (long)Z_DVAL_P(dim);
> +		case IS_DOUBLE: {
> +			DVAL_TO_LVAL(Z_DVAL_P(dim), index);
>   			goto num_index;
> -
> +		}
>

Hey, Good point Felipe, thanks!  I've updated my  patches as well to include this change and verified all the tests.

-shire

---

## #42495 — Felipe Pena — 2009-01-05T20:36:00+00:00

URL: https://externals.io/message/42456#42495 · In reply to: #42466

Hi,

Em Sáb, 2009-01-03 às 11:20 -0800, shire escreveu:
> Felipe Pena wrote:
> > […]
> 
> Hey, Good point Felipe, thanks!  I've updated my  patches as well to include this change and verified all the tests.
> 

I've committed it in 5_3 and HEAD. Ilia, should it be in 5_2 too?

Thanks for the patch, Shire. ;)

-- 
Regards,
Felipe Pena

---

## #42496 — shire — 2009-01-05T20:39:30+00:00

URL: https://externals.io/message/42456#42496 · In reply to: #42495

Felipe Pena wrote:
> Hi,
>
> Em Sáb, 2009-01-03 às 11:20 -0800, shire escreveu:
> > […]
>
> I've committed it in 5_3 and HEAD. Ilia, should it be in 5_2 too?
>
> Thanks for the patch, Shire. ;)
>


Fantastic, thanks for the commit and additional fix!

-shire

---

## #42497 — Ilia Alshanetsky — 2009-01-05T23:35:19+00:00

URL: https://externals.io/message/42456#42497 · In reply to: #42495

The fix looks to be safe enough to MFH, I see no API breakage.




> Hi,
>
> Em Sáb, 2009-01-03 às 11:20 -0800, shire escreveu:
> > […]
>
> I've committed it in 5_3 and HEAD. Ilia, should it be in 5_2 too?
>
> Thanks for the patch, Shire. ;)
>
> -- 
> Regards,
> Felipe Pena
>

Ilia Alshanetsky

---

## #42498 — Felipe Pena — 2009-01-06T01:36:48+00:00

URL: https://externals.io/message/42456#42498 · In reply to: #42497

Em Seg, 2009-01-05 às 18:35 -0500, Ilia Alshanetsky escreveu:
> The fix looks to be safe enough to MFH, I see no API breakage.

OK, done.

-- 
Regards,
Felipe Pena

---

## #42499 — Ilia Alshanetsky — 2009-01-06T01:59:19+00:00

URL: https://externals.io/message/42456#42499 · In reply to: #42498

Thanks.




> Em Seg, 2009-01-05 às 18:35 -0500, Ilia Alshanetsky escreveu:
> > […]
>
> OK, done.
>
> -- 
> Regards,
> Felipe Pena
>

Ilia Alshanetsky
