andig / videodb

The videoDB media collection software
65 stars 42 forks source link

fix preg_quote statements #175

Closed johanneskonst closed 1 year ago

johanneskonst commented 1 year ago

I don't think it works like you think it works (tm) This removes a ton of warnings from my error_log. Trace page still doesn't work for me, but that's another issue...

copperhead57 commented 1 year ago

@johanneskonst have been looking at why your results may be different to mine i m using php 5.6 where the # is not excaped but is from php 7.3. i am using the # as a delimiter of preg_match string. in 7.3 # is a now special regular expression character. i think the code should be changed to $pattern = '#'. preg_quote($find_string).'#'; i have included this change into pr178

johanneskonst commented 1 year ago

I'm running 7.4 (for now) and got these 'errors' in my error.log when debug=1 Basically notices (i think) but I like to improve code wherever I can. The 'bug' in this case was using preg_quote on the whole $pattern instead of just the part that should do the matching; after that also added the second argument for good measure (and stability, it's better to be precise et al...) And please don't include existing PR changes in a new PR, it makes merging difficult etc. It would be preferred to accept the first PR and make additional/reverting changes in a second PR.