[wp-trac] [WordPress Trac] #63751: wpdb->set_prefix() throws deprecation notice for preg_match() when setup-config.php is loaded
WordPress Trac
noreply at wordpress.org
Sat Jul 26 09:10:05 UTC 2025
#63751: wpdb->set_prefix() throws deprecation notice for preg_match() when setup-
config.php is loaded
-------------------------+-------------------------------------------------
Reporter: jerclarke | Owner: (none)
Type: defect | Status: new
(bug) |
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 6.8.2
Severity: minor | Resolution:
Keywords: | Focuses: coding-standards, php-
| compatibility
-------------------------+-------------------------------------------------
Comment (by sabernhardt):
> The "real" cause, I don't know. Why is there no `$prefix` available when
normally there would be? Should there be?
The cause is highly important to understanding how to fix it. I think the
real solution would be found outside the `wpdb` class.
However, if its `set_prefix` method should require a `$prefix` (#16229),
then returning the `invalid_db_prefix` error could stop the operations:
{{{
if ( ! $prefix || preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
return new WP_Error( 'invalid_db_prefix', 'Invalid database
prefix' );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63751#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list