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

fixed In PHP, it's deprecated to pass a null value to the first param… #7947

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions includes/sanitizers/class-amp-img-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ private function maybe_add_lightbox_attributes( $attributes, $node ) {
private function is_gif_url( $url ) {
$ext = self::$anim_extension;
$path = wp_parse_url( $url, PHP_URL_PATH );
// 检查$path是否为null,若是则赋值为空字符串
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this project, code comments are in English. In any case, no need for a comment here since the reason is self-explanatory:

Suggested change
// 检查$path是否为null,若是则赋值为空字符串

$path = $path?? '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 检查$path是否为null,若是则赋值为空字符串
$path = $path?? '';
if ( null === $path ) {
return false;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for taking the time to review my PR and providing such valuable suggestions. I really appreciate.

return substr( $path, -strlen( $ext ) ) === $ext;
}

Expand Down