caseproof / members

Members WordPress plugin.
GNU General Public License v2.0
78 stars 35 forks source link

Issue with conflicting `bootstrap/app.php` files #55

Closed adamtomat closed 1 year ago

adamtomat commented 3 years ago

This relates specifically to the "Members - Admin Access" plugin.

The following line includes a file called bootstrap/app.php: https://github.com/caseproof/members/blob/develop/addons/members-admin-access/addon.php#L3

The intent here is to include the file in the addon folder. However in our case, we also have a boostrap/app.php file at the root of our theme (which bootstraps our framework).

What happens is that the require_once matches our file before it matches yours, breaking our site. From our end, we have renamed our app.php file to something else however I think it's worth being explicit with your require_once call by telling it to only look in the current directory:

So instead of this:

<?php

require_once( 'bootstrap/app.php' );

You do this:

<?php

require_once( __DIR__.'/bootstrap/app.php' );

It's a simple change that is backwards compatible and just prevents issues like this from cropping up.