Issues

ZF-2090: More efficient differentiation between structs and arrays

Description

Instead of iterating over each key, array_keys() in combination with range() is much faster to determine wheither it is an array or a struct.

Comments

Scheduling for 1.0.3

Updated and pushed to release branch as of r6938.

I'm sorry, but you change made it even worse. I attached a benchmark between our two strategies to differentiate.

Here is my result: array_reduce(): 1.23774003983 count()/range(): 0.39503288269

Scheduling for 1.5.0RC2

Applied in trunk and 1.5 release branch

This patch highlights a huge issue with array/struct detection.

With the patch applied, we now have a situation where passing an empty array to a field expecting an array now results in an invalid argument exception -- because the empty array is incorrectly detected as a struct.

Before the patch was applied, we had the opposite siutation: passing an empty array to a field expecting a struct resulted in an invalid argument exception, because the empty array was detected as an array.

I'm re-opening the ticket, as we need to do some detection in the client for empty arrays and cast them to the appropriate types.

Fix committed in trunk in r8953 and in release-1.5 branch in r 8954. This should resolve all issues at this point.