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

[1.x] fix(core, mentions): return null if content left empty in formatter #4059

Merged
merged 11 commits into from
Oct 8, 2024
Prev Previous commit
Next Next commit
fix(mentions): return early if xml null
  • Loading branch information
DavideIadeluca committed Oct 7, 2024
commit 20c292c60566ae35e773fe67ed6e4ad88f9d6a3a
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparsePostMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 37 in extensions/mentions/src/Formatter/UnparsePostMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updatePostMentionTags($context, $xml);
$xml = $this->unparsePostMentionTags($xml);

Expand Down
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparseTagMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 27 in extensions/mentions/src/Formatter/UnparseTagMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updateTagMentionTags($context, $xml);
$xml = $this->unparseTagMentionTags($xml);

Expand Down
4 changes: 4 additions & 0 deletions extensions/mentions/src/Formatter/UnparseUserMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
*/
public function __invoke($context, $xml)
{
if ($xml === null) {

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Strict comparison using === between string and null will always evaluate to false.

Check failure on line 38 in extensions/mentions/src/Formatter/UnparseUserMentions.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Strict comparison using === between string and null will always evaluate to false.
return $xml;
}

$xml = $this->updateUserMentionTags($context, $xml);
$xml = $this->unparseUserMentionTags($xml);

Expand Down
Loading