https://bugs.kde.org/show_bug.cgi?id=486372
Bug ID: 486372
Summary: Incorrect syntax highlighting of PHP strings that
contain an opening bracket
Classification: Applications
Product: kate
Version: unspecified
Platform: Other
OS: Microsoft Windows
Status: REPORTED
Severity: normal
Priority: NOR
Component: application
Assignee: kwrite-bugs-n...@kde.org
Reporter: saul...@legtux.org
Target Milestone: ---
Created attachment 169053
--> https://bugs.kde.org/attachment.cgi?id=169053&action=edit
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
--
You are receiving this mail because:
You are watching all bug changes.