Make WordPress Core

Opened 5 months ago

Last modified 5 weeks ago

#61214 assigned defect (bug)

Hello Dolly : Uncaught exception 'Error' with message 'Call to undefined function add_action()

Reported by: deepakrohilla's profile deepakrohilla Owned by: deepakrohilla's profile deepakrohilla
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch
Focuses: Cc:

Description

error.message LIKE 'Uncaught exception 'Error' with message 'Call to undefined function add_action()' in /var/www/wp-content/plugins/hello.php:69%' AND error.class = 'Error' AND transactionUiName = '/wp-content/plugins/hello.php'

'request_uri': '/wp-content/plugins/hello.php'

Change History (8)

This ticket was mentioned in PR #6553 on WordPress/wordpress-develop by @deepakrohilla.


5 months ago
#1

  • Keywords has-patch added

#2 @SergeyBiryukov
5 months ago

Hi there, thanks for the ticket!

A similar issue was addressed in [49619] / #35835 for wp-includes/rss-functions.php.

Unless I'm missing something, calling directly pretty much any other file in wp-includes or wp-admin/includes would lead to the same issue, so if we want to add an early exit, it might be a good idea to do that in a consistent way.

Related: #47154, #51806, #55944, #61277, #61286.

#3 @deepakrohilla
5 months ago

@SergeyBiryukov I have cover maximum number of files of wp-includes & wp-admin directory and raised in https://core.trac.wordpress.org/ticket/61314#ticket with patch

could you confirm that I'm not missing something with this change.

@szepe.viktor commented on PR #6553:


4 months ago
#4

I core I see simple die()-s without -1.

@deepakrohilla commented on PR #6553:


4 months ago
#5

I core I see simple die()-s without -1.

Hi @szepeviktor Thanks, yes this can be simply die without -1. but in core like
\wp-admin\edit-link-form.php and wp-admin\edit-form-comment.php and many other's file of core , we are already using

Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {

die( '-1' );

}

@deepakrohilla commented on PR #6553:


3 months ago
#7

Hi @szepeviktor , Could you please suggest what we should use? In many places in the core files, we are using die('-1');, while in some files, I have seen a simple die();.

@szepe.viktor commented on PR #6553:


3 months ago
#8

@deepakrohillas Exit status is for CLI only.
https://www.php.net/manual/en/function.exit.php
So die()

Note: See TracTickets for help on using tickets.