Home

>

Tools

>

WordPress

>

Releases

>

4.0.20

WordPress Release: 4.0.20

Tag Name: 4.0.20

Release Date: 10/31/2017

WordPress LogoWordPress

World's most popular open-source content management system powering over 40% of all websites. Offers extensive plugin ecosystem, themes, and robust community support for blogs, e-commerce, and corporate websites. Highly customizable and scalable platform suitable for beginners and advanced developers.

TL;DR

WordPress 4.0.20 restores support for numbered placeholders in wpdb::prepare() queries, which was previously removed in version 4.0.19 (via [41496]). This update maintains backward compatibility for developers who relied on this undocumented but widely used feature, while also adding safety checks to ensure the correct number of arguments are passed to the function based on the number of placeholders used.

Highlight of the Release

    • Restored support for numbered placeholders in wpdb::prepare() database queries
    • Added validation to ensure the correct number of arguments match the placeholders used
    • Fixed compatibility issues introduced in version 4.0.19
    • Restored support for a subset of placeholder formatting options

Migration Guide

No specific migration steps are required for this release. This update restores functionality that was removed in 4.0.19, making it a compatibility improvement rather than requiring migration.

If you had modified your code to work around the removal of numbered placeholders in 4.0.19:

  • You can revert those changes if desired, as the numbered placeholder syntax will work again
  • Both approaches (numbered and non-numbered placeholders) will now work correctly
  • The new argument count validation will help identify any incorrect usage of wpdb::prepare()

Upgrade Recommendations

This release is recommended for all WordPress 4.0.x users, especially those who:

  • Experienced issues after upgrading to 4.0.19
  • Use plugins or themes that interact with the database using custom queries
  • Develop custom code that utilizes wpdb::prepare() with numbered placeholders

The update restores compatibility while enhancing security through better parameter validation, making it beneficial for all WordPress 4.0 installations.

Bug Fixes

Database Query Preparation Fix

  • Fixed the removal of numbered placeholders in wpdb::prepare() that occurred in version 4.0.19 ([41496])
  • Restored compatibility for code that relied on the undocumented but widely used numbered placeholder syntax
  • Addressed issue #41925 related to database query preparation

This fix ensures that existing code using numbered placeholders (like %1$s, %2$d, etc.) in database queries will continue to function as expected.

New Features

While this release primarily focuses on restoring previously removed functionality, it does include enhanced validation for wpdb::prepare():

  • Added new checks to validate that the number of arguments passed to wpdb::prepare() matches the number of placeholders in the query
  • Restored support for a subset of placeholder formatting options that work alongside the numbered placeholders

Security Updates

While not explicitly labeled as a security fix, this release enhances query safety by:

  • Adding validation to ensure the correct number of arguments are provided for placeholders in database queries
  • Preventing potential issues that could arise from mismatched placeholder and argument counts
  • Maintaining proper query preparation which is essential for preventing SQL injection attacks

These improvements help maintain WordPress's database query security model.

Performance Improvements

No specific performance improvements were included in this release. The changes focus on compatibility and functionality restoration rather than performance enhancements.

Impact Summary

WordPress 4.0.20 addresses a significant compatibility issue introduced in 4.0.19 that affected many developers and site owners. By restoring support for numbered placeholders in wpdb::prepare(), this release ensures that existing code continues to function as expected while also improving security through better validation.

The impact is primarily positive for developers who relied on this syntax pattern, as they no longer need to update their code to accommodate the removal. Site administrators benefit from improved stability and fewer potential plugin/theme conflicts.

This release demonstrates WordPress's commitment to maintaining backward compatibility while still improving security practices. The added validation ensures that even though the undocumented feature is restored, it's implemented in a way that encourages proper usage and prevents potential security issues from mismatched arguments.

Statistics:

File Changed8
Line Additions578
Line Deletions49
Line Changes627
Total Commits3

User Affected:

  • Developers who used numbered placeholders in `wpdb::prepare()` can continue using this syntax without breaking changes
  • Code that broke after 4.0.19 will now work again with this restoration
  • Benefit from additional safety checks that ensure correct argument count for placeholders

Contributors:

pentoswissspidy