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

array_merge of $options in Database::__construct() loses keys. #11

Closed
rhys-mcguckin opened this issue Dec 28, 2015 · 2 comments
Closed
Assignees

Comments

@rhys-mcguckin
Copy link

According to http://php.net/manual/en/function.array-merge.php, the keys that are being set in https://github.com/FaaPz/Slim-PDO/blob/master/src/PDO/Database.php under the __construct function, are being renumbered, so they are being passed to the parent constructor using the incorrect values.

I'd suggest using "$options += array(default options)" statement instead, which preserves the numeric keys, while allowing what I believe is the intended behaviour here.

@FaaPz FaaPz self-assigned this Dec 28, 2015
@FaaPz
Copy link
Owner

FaaPz commented Dec 28, 2015

You're right! Just released v1.9.2 (f557397) with the fix included... 😁

@FaaPz FaaPz closed this as completed Dec 28, 2015
@cristianp6
Copy link

Hi @FaaPz !
First of all thanks for this usefull library ;-)

Anyway, construct still loses given $options, indeed merge on line 31 should be:
$options = $options + $this->getDefaultOptions();
or, as suggested by rhys-mcguckin, in a shorten way
$options += $this->getDefaultOptions();

Am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants