Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#55936 new defect (bug)

ABSPATH & WPINC

Reported by: lkhlc's profile lkhlc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Errors throwing on core scripts:
Has been filling error logs for days
Happened in previous version and now happens in Current version: 6.0

[05-Jun-2022 23:26:45 UTC] PHP Warning:  Use of undefined constant ABSPATH - assumed 'ABSPATH' /wp-includes/class-wp-http.php on line 11
[05-Jun-2022 23:26:45 UTC] PHP Warning:  Use of undefined constant WPINC - assumed 'WPINC' /wp-includes/class-wp-http.php on line 11
[05-Jun-2022 23:26:45 UTC] PHP Warning:  require(ABSPATHWPINC/class-requests.php): failed to open stream: No such file or directory in wp-includes/class-wp-http.php on line 11
[05-Jun-2022 23:26:45 UTC] PHP Fatal error:  require(): Failed opening required 'ABSPATHWPINC/class-requests.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in public_html/wp-includes/class-wp-http.php on line 11
[05-Jun-2022 23:26:51 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_the_block_template_html() in /wp-includes/template-canvas.php:12
Stack trace:
#0 {main}
  thrown in wp-includes/template-canvas.php on line 12
[05-Jun-2022 23:27:01 UTC] PHP Warning:  Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in /wp-includes/blocks/index.php on line 9
[05-Jun-2022 23:27:01 UTC] PHP Warning:  Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in /wp-includes/blocks/index.php on line 9
[05-Jun-2022 23:27:01 UTC] PHP Warning:  require(ABSPATHWPINC/blocks/archives.php): failed to open stream: No such file or directory in /wp-includes/blocks/index.php on line 9
[05-Jun-2022 23:27:01 UTC] PHP Fatal error:  require(): Failed opening required 'ABSPATHWPINC/blocks/archives.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /wp-includes/blocks/index.php on line 9
[05-Jun-2022 23:27:07 UTC] PHP Fatal error:  Uncaught Error: Class 'WP_Widget' not found in /wp-includes/widgets/class-wp-widget-block.php:17
Stack trace:
#0 {main}
  thrown in /wp-includes/widgets/class-wp-widget-block.php on line 17

Change History (5)

#1 @SergeyBiryukov
21 months ago

  • Description modified (diff)

#2 @pbiron
21 months ago

Sorry you're having problems.

I can't be 100% sure, but looking at the error messages you're receiving I think there is a problem in your wp-config.php file.

Down near the bottom, you should see something like:

<?php
if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH', __DIR__ . '/' );
}

Note the trailing slash ('/'). If you define ABSPATH in some other config file that gets included before that line in wp-config.php, make sure that the value also has the trailing slash.

#3 @lkhlc
21 months ago

Wish it were so. Thanks for the reply. wp-config contains

/ Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {

define( 'ABSPATH', DIR . '/' );

}

always has.. also no reference to ABSPATH anywhere on purpose programmatically ;-)

#4 @jorbin
21 months ago

  • Keywords reporter-feedback added

Do these messages align with attempts to directly access files within wp-includes? It seems like you may have some traffic going to DOMAIN/wp-includes/widgets/class-wp-widget-block.php and DOMAIN/wp-includes/class-wp-http.php

#5 @lkhlc
21 months ago

The site is locked down. No access other than builders and corp types. No auto processes are running specially and no crontabs are activated. Every night the same set of errors.
class-wp-http.php throws a hissy fit at ABSPATH line 11.... it all goes down hill from there.. every night. and nobody is there doing anything. This is the same set of errors every night. An internal WP Cron perhaps? Regardless ABSPATH was warned and now its not working.

<?php
Stack trace:
#0 {main}
  thrown in /home/[DOMAIN]/public_html/wp-includes/template-canvas.php on line 12
[08-Jun-2022 16:51:01 UTC] PHP Warning:  Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in /home/[DOMAIN]/public_html/wp-includes/blocks/index.php on line 9
[08-Jun-2022 16:51:01 UTC] PHP Warning:  Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in /home/[DOMAIN]/public_html/wp-includes/blocks/index.php on line 9
[08-Jun-2022 16:51:01 UTC] PHP Warning:  require(ABSPATHWPINC/blocks/archives.php): failed to open stream: No such file or directory in /home/[DOMAIN]/public_html/wp-includes/blocks/index.php on line 9
[08-Jun-2022 16:51:01 UTC] PHP Fatal error:  require(): Failed opening required 'ABSPATHWPINC/blocks/archives.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/[DOMAIN]/public_html/wp-includes/blocks/index.php on line 9
[08-Jun-2022 16:52:31 UTC] PHP Fatal error:  Uncaught Error: Class 'WP_Widget' not found in /home/[DOMAIN]/public_html/wp-includes/widgets/class-wp-widget-block.php:17
Stack trace:
#0 {main}
  thrown in /home/[DOMAIN]/public_html/wp-includes/widgets/class-wp-widget-block.php on line 17
Note: See TracTickets for help on using tickets.