Created attachment 169053 [details] The error in pictures The code snippet below illustrates the problem. Any occurrence of \{ inside a string causes a false coloring in the block between curly brackets following it. /** * Create a preg pattern for checking presence of a WIKINDX_NO_SORT value at the beginning of a string. * * If empty($noSortArray), then we use WIKINDX_NO_SORT (and assume that WIKINDX_NO_SORT has been checked for content). * Otherwise, $noSortArray is from admin::configure::updateNoSort() * * @param array $noSortArray Default is [] * * @return string */ function noSortPattern( array $noSortArray = [], ): string { if (empty($noSortArray)) { $noSortArray = \UTF8\mb_explode(',', WIKINDX_NO_SORT); } foreach ($noSortArray as $patt) { $patt = preg_quote($patt, '@'); $pattern[] = "^($patt)\\s"; $pattern[] = "^(\{$patt)\\s"; $pattern[] = "^(<.*>)($patt)\\s(.*)(<.*>)"; $pattern[] = "^(<.*>)(\{$patt)\\s?(.*)(<.*>)"; $pattern[] = "^(<.*>)($patt)(.*)(<.*>)\\s"; $pattern[] = "^(<.*>)(\{$patt)(.*)(<.*>)\\s"; } return '@' . implode('|', $pattern) . '@Usiu'; } /** * Write a hashed version of a user password in users table * * Implementation history: see \UTILS\verifyUserPassword() * * @param SQL $db An SQL object * @param string $usersId A user Id * @param string $usersPassword A clear password to encrypt/hash */ function writeUserPassword( \SQL $db, int $usersId, string $usersPassword, ): void { $hash = \password_hash($usersPassword, PASSWORD_DEFAULT); $updateArray["usersPassword"] = $hash; $usertable = "users"; // TODO(LkpPo): remove this conditon when the upgrade code of step 57 (6.4.7) is retired. if (!$db->tableExists($usertable)) { $usertable = "wkx_users"; } $db->formatConditions(["usersId" => $usersId]); $db->update($usertable, $updateArray); } STEPS TO REPRODUCE 1. 2. 3. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION
Created attachment 169054 [details] Code reproducing the error
Checked with Kate 24.07.70 on Windows 11
Git commit d6e2fdf3841dc46c370cd2f5756566cd1e5a82c3 by Christoph Cullmann, on behalf of Jonathan Poelen. Committed on 22/08/2024 at 16:01. Pushed by cullmann into branch 'master'. PHP: add \{ in double quote string as a Backslash Code M +1 -0 autotests/folding/highlight.php.fold M +1 -0 autotests/html/highlight.php.dark.html M +1 -0 autotests/html/highlight.php.html M +1 -0 autotests/input/highlight.php M +1 -0 autotests/reference/highlight.php.ref M +2 -2 data/syntax/php.xml https://invent.kde.org/frameworks/syntax-highlighting/-/commit/d6e2fdf3841dc46c370cd2f5756566cd1e5a82c3