bobbingwide / oik-bwtrace

debug trace for WordPress
https://www.oik-plugins.com/oik-plugins/oik-bwtrace-debug-trace-for-wordpress/
GNU General Public License v2.0
6 stars 1 forks source link

Function name conflict with ep() #118

Open bobbingwide opened 2 hours ago

bobbingwide commented 2 hours ago

See https://github.com/bobbingwide/bobbingwide/issues/132

Requirement

To avoid Fatal errors such as this one

[21-Sep-2024 12:51:00 UTC] PHP Fatal error: Cannot redeclare ep() (previously declared in C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\libs\bobbfunc.php:395) in C:\apache\htdocs\wordpress\wp-content\plugins\sprout-invoices\template-tags\utility.php on line 330

the function named ep(), which is delivered in the libs\bobbfunc.php shared library should be changed to bw_ep().

Proposed solution

The libs\bobbfunc.php shared library file is delivered by several other plugins but very few of these plugins actually use the function. So they aren't affected by the change.

Those plugins which do use ep() can be changed in advance of updating oik-bwtrace so that they are no longer dependent upon the function. Rather than changing them to use bw_ep(), they can be changed to use the one line of code equivalent.

From

ep();

to

bw_echo( '</p>' );

Since this change would be a breaking change, if the code were implemented on the wrong order, the major version numbers should be updated for both the plugin ( from 3.5.0 to 4.0.0 ) and the shared library file ( from 3.6.0 to 4.0.0 ).

The update to oik-bwtrace should be delivered after the other affected plugins have been updated.

bobbingwide commented 2 hours ago

See also https://wordpress.org/support/topic/function-name-conflict-too-generic/#post-18028492 which will need to be updated when the new version is delivered.