oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlockSpam default path to spammers.txt is wrong

VincentSurelle opened this issue · comments

The BlockSpam middleware is looking for a wrong path a default

Actually looking for :

__DIR__.'/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt'
mean
/Users/vincent/Work/hello-world/vendor/oscarotero/psr7-middlewares/src/Middleware/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt

Real path is :

__DIR__.'/../../../../piwik/referrer-spam-blacklist/spammers.txt'
mean
/Users/vincent/Work/hello-world/vendor/oscarotero/psr7-middlewares/src/Middleware/../../../../piwik/referrer-spam-blacklist/spammers.txt

Yes, it depends how was installed psr-7-middlewares (as a root package or as a dependency).
You can use composer-locator to locate the real path of spammers.txt

But is also a good idea to check both possible paths (as root or as dependency) to cover the two most common scenarios. Do you want to work in a pull request?