[wp-trac] [WordPress Trac] #35560: Use of undefined constant DB_USER - assumed 'DB_USER'

WordPress Trac noreply at wordpress.org
Tue Jan 9 05:07:47 UTC 2018


#35560: Use of undefined constant DB_USER - assumed 'DB_USER'
--------------------------+-----------------------
 Reporter:  mariusvw      |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  5.0
Component:  Database      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------
Changes (by dd32):

 * keywords:  reporter-feedback => needs-patch
 * milestone:  Awaiting Review => 5.0


Comment:

 This does actually need to be fixed, and is an issue.
 Although most users should not see this warning, as error visibility is
 turned off at the point in time.
 `wp-admin/setup-config.php` includes `wp-settings.php` which calls
 `require_wp_db()` which references these constants.

 As of PHP 7.2 the warning reads:
 > Warning: Use of undefined constant DB_USER - assumed 'DB_USER' (this
 will throw an Error in a future version of PHP)

 According to http://php.net/manual/en/migration72.deprecated.php the next
 major PHP version will throw a fatal error instead of an undefined
 constant warning.

 I think `require_wp_db()` can probably just define
 `DB_(USER|PASSWORD|HOST|NAME)` etc as `null` in the event that they're not
 already defined.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35560#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list