Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property description special property is trimmed incorrectly on saving #5710

Open
alex-mashin opened this issue Aug 17, 2024 · 0 comments
Open
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error

Comments

@alex-mashin
Copy link
Contributor

alex-mashin commented Aug 17, 2024

PHP 8.3.10, MW 1.39.8, SMW 4.2.0.

An ask query fails silently, showing an exception if debugging is on. The results of the ask query contain Unicode characters, which can be illegal, if some non-Unicode aware string operations had been applied to it.

I have traced the exception, so far, to includes/MagicWord.php; MagicWord::matchAndRemove(). preg_replace_callback() returns null; which is passed as subject string to preg_replace_callback() on the next magic word causing an exception.

The magic word ($this->getRegex()) causing error is /__NOFACTBOX__/iu (removing u removes the error but another error happens later again with a null instead of a string). The $text is a longish result of a successful SMW query (widetable format), containing non-Latin characters; and also a terminating <span class="smwttcontent"> with a property description. I suspect that the property description had been trimmed incorrectly.

The property Has property description for one of the queried properties is set to an evidently illegal Unicode string finishing with a .

UPDATE: The value is set to {{#set: Has property description = Свойство для хранения регулярного выражения с захватами-селекторами для разбора страницы с форматом <code>text</code>. селекторы в этом случае представляют захваты. Используется в подъобъектах.@ru}}. However, it is stored as Свойство для хранения регулярного выражения с захватами-селекторами для разбора страницы с форматом <code>text</code>. селекторы в этом случае представляют захваты. Ис�.

It seems to be trimmed somewhere before saving, but trimmed incorrectly, disregarding that it contains non-Latin Unicode sequences.

@alex-mashin alex-mashin added the bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error label Aug 17, 2024
@alex-mashin alex-mashin changed the title preg_replace_fallback fails silently on {{#ask:}} Property description special property is trimmed incorrectly on saving Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error
Projects
None yet
Development

No branches or pull requests

1 participant