Re: [VOTE] Fix list() behavior inconsistency
| From: | Dmitry Stogov | Date: | Thu, 25 Sep 2014 21:45:52 +0000 |
| Subject: | Re: [VOTE] Fix list() behavior inconsistency | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77634@lists.php.net to get a copy of this message | ||
FETCH_DIM_TMP_VAR is used especiualy for list().
It expects array, don't check for objects and strings.
It doesn't remove the operand and allow it's reuse in next opcode.
FETCH_DIM_R is used for list() only in some cases (when operand IS_VAR).
To work in list() context it has to keep operand not destroyed, and to do
it FETCH_DIM_R has to check for (opline->extended_value &
ZEND_FETCH_ADD_LOCK).
Note that this check has to be executed for each array access operation
unrelated to list() handling.
Thanks. Dmitry.
On Fri, Sep 26, 2014 at 12:32 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Thu, Sep 25, 2014 at 1:15 PM, Dmitry Stogov <dmitry@zend.com> wrote:
>
>> disabling string handling would allow make operation simpler and would
>> improve regular access to array elements.
>> We won't need to check for (opline->extended_value & ZEND_FETCH_ADD_LOCK)
>> in FETCH_DIM_R handler.
>> However, it's going to be very small improvement, and I don't care a lot.
>> :)
>>
>> enabling string handling would require complication of
>> ZEND_FETCH_DIM_TMP_VAR handler (for strings support).
>> It's going to make list() handling a bit slower, but not significantly.
>>
>> my choice +1 for disabling.
>>
>
> Could you please clarify why removing string support would make the
> operation simpler? I voted for always supporting strings because I thought
> that is the option that simplifies things - in particular it would allow
> use to drop the FETCH_DIM_TMP_VAR opcode and always go through FETCH_DIM_R
> instead. Sample patch here:
> https://github.com/nikic/php-src/compare/stringOffsetsInList Or
> did I
> miss something and we can't do that?
>
> Nikita
>