You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wpbones_modules() cannot load a module whose name ends with 'p' or 'h' #142
wpbones_modules() (and import()) build the file name with rtrim($file, '.php') . '.php'. The second argument of rtrim is a list of characters, so every trailing ., p and h is removed, not only the .php suffix:
call
file that is loaded
wpbones_modules('shop')
plugin/modules/sho.php
wpbones_modules('map')
plugin/modules/ma.php
wpbones_modules('Help.php')
plugin/modules/Hel.php
Expected: only a .php suffix is removed before .php is added, for example preg_replace('/\.php$/', '', $file) . '.php'.
Seen on master (v3.3.0), src/helpers.php, PHP 8.5.
@bardrop thanks, the table with the three names made this one quick to confirm 🙏 you're right, rtrim() takes a list of characters, not a suffix, so any module name ending in ., p or h lost its tail... it's been like that since the helper landed in 1.8.0
fixed in #144: .php is appended only when the name doesn't already end with it, and import() gets the fix too since it's just an alias. there's a unit test for it, plus a run in a real WordPress install with your three names that fails on 3.3.0 and passes on the fix. it's out in v3.3.1, composer update wpbones/wpbones and you're set
Activity
🐛 fix(helpers): wpbones_modules() loads a module whose name ends with…
gfazioli commentedon Nov 23, 2026
@bardrop thanks, the table with the three names made this one quick to confirm 🙏 you're right,
rtrim()takes a list of characters, not a suffix, so any module name ending in.,porhlost its tail... it's been like that since the helper landed in 1.8.0fixed in #144:
.phpis appended only when the name doesn't already end with it, andimport()gets the fix too since it's just an alias. there's a unit test for it, plus a run in a real WordPress install with your three names that fails on 3.3.0 and passes on the fix. it's out in v3.3.1,composer update wpbones/wpbonesand you're set