php5 compatibility: array_fill_keys substitution (if necessary)
pbaggio - November 25, 2008 - 18:02
| Project: | Graphviz Filter |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
as of "array_fill_keys" help page in php site, there's a contribution by matrebatre stating that this function is the same as "$array = array_combine($keys,array_fill(0,count($keys),$value));"... if it's true, you can achieve php5 compatibility adding the following script (it would be better to place this script in a sort of "heading" place, calling it just one time if possible):
//---- begin script ------------------------------------------
if (!function_exists('array_fill_keys')) {
function array_fill_keys($keys,$value) {
return array_combine($keys,array_fill(0,count($keys),$value));
}
}
//---- end script ------------------------------------------it immediatly clear that the script above create a new function only if necessary, that is when the original one isn't found.
if you notice that in some cases the equivalence stated is not fully correct, just modify the script above accordingly.

#1
I'm planning to revisit the design of Graphviz Filter. I might not need that patch then.
#2
Fixed in 6.x-1.3. The module no longer needs that function.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.