heimrichhannot / contao-haste_plus

GNU Lesser General Public License v3.0
0 stars 4 forks source link

semicolon bug in PaletteManipulator #11

Closed simonreitinger closed 5 years ago

simonreitinger commented 5 years ago

I just discovered a possible bug in this file: https://github.com/heimrichhannot/contao-haste_plus/blob/master/dca/tl_settings.php

$strPalette = '{haste_legend},loadGoogleMapsAssetsOnDemand,headerAddXFrame,headerXFrameSkipPages,headerAllowOrigins,hpProxy;';

$dc['palettes']['default'] = str_replace('{chmod_legend', $strPalette . ';{chmod_legend', $dc['palettes']['default']);

which in my case results in this string:

{title_legend},websiteTitle;{date_legend},dateFormat,timeFormat,datimFormat,timeZone;{global_legend:hide},adminEmail,characterSet,minifyMarkup,gzipScripts;{backend_legend:hide},resultsPerPage,maxResultsPerPage,fileSyncExclude,doNotCollapse,staticFiles,staticPlugins;{frontend_legend},useAutoItem,folderUrl,doNotRedirectEmpty,disableCron;{proxy_legend:hide},sslProxyDomain;{security_legend},disableRefererCheck,allowedTags;{files_legend:hide},allowedDownload,editableFiles,templateFiles,gdMaxImgWidth,gdMaxImgHeight;{uploads_legend:hide},uploadTypes,maxFileSize,imageWidth,imageHeight;{search_legend:hide},enableSearch,indexProtected;{timeout_legend:hide},undoPeriod,versionPeriod,logPeriod,sessionTimeout;{haste_legend},loadGoogleMapsAssetsOnDemand,headerAddXFrame,headerXFrameSkipPages,headerAllowOrigins,hpProxy;;{chmod_legend:hide},defaultUser,defaultGroup,defaultChmod;{tiny_compress_images_legend},tinypng_api_key

The part that bothers me is hpProxy;;{chmod_legend:hide}

Shouldn't it be only one semicolon instead of two?

I get an error because there is an empty group:

Array
(
    [0] => {title_legend},websiteTitle
    [1] => {date_legend},dateFormat,timeFormat,datimFormat,timeZone
    [2] => {global_legend:hide},adminEmail,characterSet,minifyMarkup,gzipScripts
    [3] => {backend_legend:hide},resultsPerPage,maxResultsPerPage,fileSyncExclude,doNotCollapse,staticFiles,staticPlugins
    [4] => {frontend_legend},useAutoItem,folderUrl,doNotRedirectEmpty,disableCron
    [5] => {proxy_legend:hide},sslProxyDomain
    [6] => {security_legend},disableRefererCheck,allowedTags
    [7] => {files_legend:hide},allowedDownload,editableFiles,templateFiles,gdMaxImgWidth,gdMaxImgHeight
    [8] => {uploads_legend:hide},uploadTypes,maxFileSize,imageWidth,imageHeight
    [9] => {search_legend:hide},enableSearch,indexProtected
    [10] => {timeout_legend:hide},undoPeriod,versionPeriod,logPeriod,sessionTimeout
    [11] => {haste_legend},loadGoogleMapsAssetsOnDemand,headerAddXFrame,headerXFrameSkipPages,headerAllowOrigins,hpProxy
    [12] =>
    [13] => {chmod_legend:hide},defaultUser,defaultGroup,defaultChmod
    [14] => {tiny_compress_images_legend},tinypng_api_key
)
koertho commented 5 years ago

Thanks for reporting!