"casting to array and === is like 8 times faster than doing is_array(), btw.
if ((array)$arr === $arr"

However, I don't think there is a value to this check any more - maybe it was needed once but after several versions worth of warnings, it should be good to go. We don't check every random function argument to see if it's an array.

I checked this on core systems and found similar results - a small but measurable performance impact, basically an easy win.

Sam Marshall
added a comment - 01/May/13 3:56 PM note: Eloy points out that it's possible to do is_array faster:
"casting to array and === is like 8 times faster than doing is_array(), btw.
if ((array)$arr === $arr"
However, I don't think there is a value to this check any more - maybe it was needed once but after several versions worth of warnings, it should be good to go. We don't check every random function argument to see if it's an array.
I checked this on core systems and found similar results - a small but measurable performance impact, basically an easy win.

The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

Dan Poltawski
added a comment - 02/May/13 2:29 PM The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.
TIA and ciao

Eloy Lafuente (stronk7)
added a comment - 07/May/13 8:05 PM In this case, i think the change is ok and safe, more yet s(), that uses htmlspecialchars() surely will end throwing some warning itself...so.. ok.