Opened 7 months ago
Closed 2 months ago
#63627 closed enhancement (fixed)
General: Only override `$table_prefix` if not defined
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | 6.9 |
| Component: | Bootstrap/Load | Keywords: | has-patch |
| Focuses: | php-compatibility | Cc: |
Description
Only set the variable $table_prefix, if set before (e.g. via some kind of custom bootstrapper).
To use ??= operator we need >= php8.4, but happily referring to your documentation, this is already the current minimum requirement :D
https://wordpress.org/about/requirements/
-> bumped version in composer.json
Ref: https://github.com/WordPress/wordpress-develop/pull/9087
Change History (5)
This ticket was mentioned in PR #9087 on WordPress/wordpress-develop by @Ninos Ego.
7 months ago
#1
- Keywords has-patch added
#2
@
7 months ago
Hi @ninos-ego,
Could you expand on the reasoning for the change? What are you attempting to achieve, what problem does this solve? etc
#3
@
3 months ago
Sorry for the late response...
I'm using some kind of wordpress bootstrapper to preload some environment configs before initializing wordpress, e.g. database, url, proxy, settings, ... Useful at least for containerized environments.
My current workaround is writing following line of code before including wp-settings.php:
$table_prefix = $GLOBALS['table_prefix'];
Its not much line of codes, but I want to get rid of it (object-oriented coding). My patch will not break anything, it just gives a bit more flexibility initializing wordpress :-)
Only set the variable
$table_prefix, if set before (e.g. via some kind of custom bootstrapper).To use
??=operator we need>= php8.4, but happily referring to your documentation, this is already the current minimum requirement :Dhttps://wordpress.org/about/requirements/
-> bumped version in
composer.jsonTrac:
https://core.trac.wordpress.org/ticket/63627