Backport for 3.3 branch: Fix for phar:// stream wrapper with no stub

Just read an article about 3.3.1
This is exactly the same as pull request #4080 for master branch
Modified patch similar to master
Merge pull request #4101 from nazar-pc/patch-2

Backport for 3.3 branch: Fix for phar:// stream wrapper with no stub