Opened 2 years ago

Last modified 2 years ago

#16756 reviewing enhancement

PHP5-port - Access Violations on wpdb::$prefix

Reported by: hakre Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version: 3.1
Severity: normal Keywords: has-patch
Cc: otterish@…, Backie

Description

The to be accessed privately member wpdb::$prefix is accessed publicly in multiple places.

This would do fatal errors if the property would be ported to PHP 5 with the documented behavior.

The errorneous usage in the places in question might reveal that implementation details were missed because the prefix can differ on multi-site setups which is not technically guaranteed when accessing the private member.

The private member was only used "read-only" inside the class. Probably this is a documentation issue. It's set set_prefix() and set_blog_id() functions (only) and always to the result of wpdb::get_blog_prefix().

Attachments (2)

16756.patch (3.9 KB) - added by hakre 2 years ago.
Use of get_blog_prefix()
16756.2.patch (339 bytes) - added by hakre 2 years ago.
Fix in documentation

Download all attachments as: .zip

Change History (9)

hakre2 years ago

Use of get_blog_prefix()

hakre2 years ago

Fix in documentation

The second one is just for the case that it might be argued that this is issue with documentation (instead with the code). However I do not recommend to use it.

  • Cc otterish@… added
  • Owner set to kawauso
  • Status changed from new to reviewing

Related: #16762 (for wpdb::$base_prefix)

Last edited 2 years ago by hakre (previous) (diff)

Related: #16764

  • Owner kawauso deleted

Could someone take the reviewing status off? Cheers.

  • Cc Backie added
  • Type changed from defect (bug) to enhancement
Note: See TracTickets for help on using tickets.