jbboehr / php-mustache

Mustache PHP Extension
MIT License
56 stars 22 forks source link

Use macro that will automatically get value of indirect zvals #26

Closed adambaratz closed 8 years ago

adambaratz commented 8 years ago

I ran into a situation where a hash could have a zval that indirectly refers to an zval of type IS_UNDEF. The foreach macro knows to skip undefined zvals, but it won't skip them if it only sees the IS_INDIRECT zval. This macro pulls out the value that matters here. This potentially means that 2b92410bb7743b01e2796529ddc77a2b0eb09607 isn't necessary, but since mustache_data_from_zval() is called in other contexts, it feels safer to leave it in place.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.08%) to 80.806% when pulling 62256e2ba5d11a8df18058e262beaf9946fe7c0e on wayfair:indirect into 65b0eb0c0e49398d530f99937d9ca726a1735a9e on jbboehr:master.

jbboehr commented 8 years ago

@adambaratz I'm a bit curious: do you know where the indirect zvals are coming from? I've never run into one myself during extension development, and I'm concerned my other code may not take them into account. It would be nice to have unit tests covering these cases as well.

adambaratz commented 8 years ago

See #27 for test.