Opencart: config.php creation does not escape file path 2.3.0.2 & master

Created on 29 May 2017  路  4Comments  路  Source: opencart/opencart

When installing v2.3.0.2, if the path contains a single quote this is not escaped when writing the config.php files, resulting in a php error when trying to load the site.

I have confirmed that this is still an issue in the current master.

Most helpful comment

You are right, But who use an apostrophe in the install path for god sake. I would keep just as is, as a way for identify bad paths names, because this probably will cause other kinds of errors.

All 4 comments

Can you tell wath is the error?

For v2.3.0.2
Parse error: syntax error, unexpected 's' (T_STRING), expecting ',' or ')' in C:\inetpub\KAL's\opencart\upload\config.php on line 9

Line 9 is this:
define('DIR_APPLICATION', 'C:/inetpub/KAL's/opencart/upload/catalog/');

And should be:
define('DIR_APPLICATION', 'C:/inetpub/KAL\'s/opencart/upload/catalog/');

v2.3.0.2 is affected on lines 9-19 of the config file, 11-22 of the admin config file.
The current master is affected on lines 8-10 of the config file, 11-14 of the admin config file.
The issue is the same on each effected line.

You are right, But who use an apostrophe in the install path for god sake. I would keep just as is, as a way for identify bad paths names, because this probably will cause other kinds of errors.

This is one more

admin/controller/common/filemanager.php

Search - line 39
if (substr(str_replace('\\', '/', realpath($directory . '/' . $filter_name)), 0, strlen(DIR_IMAGE . 'catalog')) == DIR_IMAGE . 'catalog') {

Replace
if (substr(str_replace('\\', '/', realpath($directory . '/')), 0, strlen(DIR_IMAGE . 'catalog')) == DIR_IMAGE . 'catalog') {

Search - line 80 and 88
implode(' ', $name)

Replace
implode('', $name) // remove withe space between ''

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VistaXP picture VistaXP  路  5Comments

nasserman picture nasserman  路  5Comments

RajatJain4061 picture RajatJain4061  路  5Comments

PrivateAlpha picture PrivateAlpha  路  3Comments

tarranjones picture tarranjones  路  6Comments