octobercms / install

Installation wizard for October CMS
122 stars 91 forks source link

Fix Problems with replace there mysql in default redis config and rem… #87

Closed brenodouglas closed 7 years ago

brenodouglas commented 7 years ago

Fix incorrect rewrite of database.php with result in redis config:

  'redis' => [

        'cluster' => false,

        'default' => 'mysql'',
            'port'     => 6379,
            'database' => 'goldmeat',
        ],

    ]

After eval return parser error because default key in redis configuration was replaced incorrectly.

In the eval function '<?php' is uncessary.

daftspunk commented 7 years ago

As per the contribution guidelines, please provide the exact steps you are taking for the issue to occur. This will be used for peer review.

brenodouglas commented 7 years ago

Create two files in folder: install_files/php/

test.php: https://gist.github.com/brenodouglas/09287fa817e3d967f4b75bf7e498b51e database.php: https://gist.github.com/brenodouglas/21c1cddb81d192d15be796302bc0e679

Run

php test.php

After verify redis config in database.php file.

My php version is: 7.0.11

brenodouglas commented 7 years ago

Any positioning on this? @daftspunk

daftspunk commented 7 years ago

Thanks for preparing this, I was able to replicate it. This is unfortunate naming of the configuration keys. The rewriter is doing its job and replacing the instructed values. The proposed fix assumes a "like-for-like" swap, so only replace the array value if the target value is also an array. This should be a last resort if we cannot find another way to solve it...