The php function array_shift() is defined as follows:
mixed function array_shift(&$array);
Which means the parameter the function is designed to accept is a variable (accepted by reference), and should not be any direct value.
However, in this line, we are sending an array as a value rather than a variable to the function:
$field = array_shift(array_keys($schema['fields']));
While this will still work, we should change the code to pass what PHP is designed to accept: a variable.
$field_keys = array_keys($schema['fields']);
$field = array_shift($field_keys);
I'll be including a patch to make this change. This should also silence any E_STRICT errors users are getting.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pass_keys_as_array_not_value-1439016-1.patch | 474 bytes | apotek |
Comments
Comment #1
apotek commentedAnd here's the patch.
Comment #2
apotek commentedThis passed the tests and has been sitting here for a couple months. Any chance we can get this in? Would like to keep our production code in line with uuid development.
We've had this code in production for almost 3 months now, and it's been working fine.
Comment #3
skwashd commentedThanks for the patch and sorry for the delay in applying it. This has been committed (04a1185) and will be included in the next official release of the module.
Comment #4
skwashd commentedFixing status.