potsky / PimpMyLog

🍭 Log viewer for your web server
http://pimpmylog.com
GNU General Public License v3.0
594 stars 89 forks source link

crash when pipe (|) is present in the regex (it is escaped) #144

Closed s0mm3rb closed 4 years ago

s0mm3rb commented 4 years ago

despite this project looks abandoned, I still post my issue here, maybe someone else can help

if I try to use a regex pattern that includes an escaped | it crashes and shows the "Oups! config file buggy" message

this regex: #^(.*)\|(.*)\|(.*)\|(.*)$#D would crash this: #^(.*)\/(.*)\/(.*)\/(.*)$#D works

but the log file I want to add uses | as separator

I have no idea on how to work this out :(

there's also a reddit post here

regards

s0mm3rb commented 4 years ago

I've looked through the code and found the part where it reads the file array https://github.com/potsky/PimpMyLog/blob/master/inc/global.inc.php#L470

it calls the content of the config file to the php json_decode function and that crashes on the \ because it needs to be escaped for json: https://i.imgur.com/Kh1K8q5.png

I've parsed my array to the online json validator here https://jsonformatter.curiousconcept.com/

the working regex now is this, with double \\

#^(.*)\\|(.*)\\|(.*)\\|(.*)$#D