Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of arguments to array_merge is incorrect leading to options not being overriden #314

Open
codewise-nicolas opened this issue Jul 14, 2022 · 0 comments

Comments

@codewise-nicolas
Copy link

Problem: root_options values that have the same key as in the default root (local) are not overridden.

Example:
'root_options' => array('URL' => 'something')
This wont override the URL attribute.

Cause:
The arguments to array_merge here

$roots[$key] = array_merge($rootOptions, $root);

are backwards for the intended functionality of allowing $rootOptions to override the $root values.

php's array_merge keeps the values from the last arguments array when there are key collisions.

Fix:
Change the order of the arguments

-            $roots[$key] = array_merge($rootOptions, $root);
+            $roots[$key] = array_merge($root, $rootOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant