#58201 closed defect (bug) (fixed)
Incorrect condition in wp_check_php_mysql_versions()
Reported by: | mikeyzm | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 6.3 |
Component: | Bootstrap/Load | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
Changeset [49161] introduced an incorrect condition in wp_check_php_mysql_versions()
:
// This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet. && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) || ! file_exists( ABSPATH . 'wp-content/db.php' ) )
This will check for the existence of db.php
at the default path ABSPATH . 'wp-content/db.php'
, even if WP_CONTENT_DIR
is defined and db.php
is placed in WP_CONTENT_DIR
.
Change History (11)
This ticket was mentioned in PR #4384 on WordPress/wordpress-develop by mikeyzm.
20 months ago
#1
- Keywords has-patch added
@hztyfoon commented on PR #4384:
20 months ago
#3
@mikeyzm
Thanks for the PR. It looks good to me.
But, I just added a review proposing using ternary operator. can U check it please?
20 months ago
#4
@hz-tyfoon You're right, using a ternary does make it more readable. I'll make the change. Thanks for the suggestion.
@SergeyBiryukov commented on PR #4384:
18 months ago
#7
Thanks for the PR! I think we can simplify the logic here a bit further, see 29c1984.
#8
follow-up:
↓ 10
@
17 months ago
- Resolution set to fixed
- Status changed from reviewing to closed
In 56152:
@audrasjb commented on PR #4384:
17 months ago
#9
committed in https://core.trac.wordpress.org/changeset/56152
#10
in reply to:
↑ 8
;
follow-up:
↓ 11
@
17 months ago
Thanks for the commit!
Replying to audrasjb:
This changeset adds a check for the existence of
db.php
at the default pathABSPATH . 'wp-content/db.php'
, even ifWP_CONTENT_DIR
is defined anddb.php
is placed inWP_CONTENT_DIR
.
Just to clarify for future reference, that's not what this changeset does :)
As noted in the ticket description, that's what [49161] did, which turned out to be incorrect.
[56152] removes the unnecessary check for db.php
at ABSPATH . 'wp-content'
, if WP_CONTENT_DIR
is defined.
If WP_CONTENT_DIR
is not defined, it checks the default location at ABSPATH . 'wp-content/db.php'
.
#11
in reply to:
↑ 10
@
17 months ago
Replying to SergeyBiryukov:
Thanks for the commit!
Replying to audrasjb:
This changeset adds a check for the existence of
db.php
at the default pathABSPATH . 'wp-content/db.php'
, even ifWP_CONTENT_DIR
is defined anddb.php
is placed inWP_CONTENT_DIR
.
Just to clarify for future reference, that's not what this changeset does :)
+1 from me.
Thanks sergey for pointing it out and clarifying.
Looks to me the clarification in your comment is helpful for future reference and clarity.
Looks to me the ticket description by mikeyzm is pretty clear. But let me try to add a bit more clarity.
Changeset [49161] (please check that changesheet first) introduced an incorrect condition.
And that is, even if WP_CONTENT_DIR
is defined & db.php
file does exist, it (the mentioned [49161] changesheet's code) goes on to check for the existance of the db.php
using ABSPATH
(ABSPATH . 'wp-content/db.php'
) even though it already checked using WP_CONTENT_DIR
and found the db.php
to be existent
. Which is not right.
Because if WP_CONTENT_DIR
is defined and db.php
is found to be existant, why should it then go again to check for the existance of the same file using ABSPATH
. That's totally unnecessary.
Hope my explanation adds bit more clarity about this ticket it's commit/changesheet ([56152]). Thanks 😊.
Trac ticket: https://core.trac.wordpress.org/ticket/58201