Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#58425 closed enhancement (wontfix)

Use wp_die in place of only die in `WP_Widget::widget()`

Reported by: shakhari's profile shakhari Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.2.2
Component: Widgets Keywords:
Focuses: Cc:

Description

I am reading class-wp-widget.php and suddenly I have found a regular php die function where as WordPress have it's own wp_die functions and WordPress code sniffers always recommended to use wp_die.

Function name: public function widget

Change History (3)

#1 follow-up: @swissspidy
4 months ago

  • Keywords changes-requested removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from Use wp_die in place of only die to Use wp_die in place of only die in `WP_Widget::widget()`

Hello and welcome to WordPress Trac!

This die() call in WP_Widget::widget() is meant as a warning for developers that they need to extend the method in their subclass. Nowadays such a class method would be declared as abstract, but for historical reasons that is not the case here.

Since it's a message meant for developers and not end users, there isn't really a need to use wp_die() here just because a linter says so.

#2 @Presskopp
4 months ago

duplicate of #58420

#3 in reply to: ↑ 1 @shakhari
4 months ago

Hello @swissspidy
Thanks for the clarifications regarding the topic.

Thanks,

Note: See TracTickets for help on using tickets.