Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed opening cast_to_int.php #136

Closed
hald9000 opened this issue Jan 11, 2018 · 1 comment
Closed

Failed opening cast_to_int.php #136

hald9000 opened this issue Jan 11, 2018 · 1 comment

Comments

@hald9000
Copy link

hald9000 commented Jan 11, 2018

On Windows, with PHP 5.6.31.0, I'm getting an error from my WordPress 4.8 installation that reports:
'require_once(): Failed opening required 'C:\CustPub\PhsMobileCom\WebSite\wp-includes\random_compat/cast_to_int.php'.

The paths seem not to be Windows compatible as line fails during the execution of "require_once $RandomCompatDIR.'/cast_to_int.php';". While it appears that folks in various articles indicate mixing of forward and backward slash in a path should work on Windows; I can tell you it just does not on my Windows Server 2012 R2 (with all latest patches). This path issue also seems to be true for "byte_safe_strings.php" and possibly "error_polyfill.php" too.

I'm a sysadmin and don't really get into this level of PHP code for Wordpress installations so I'm not sure what to recommend to fix this. It looks like this could be a large issue across this project.

However, for the purposes of fixing Wordpress, changing the three require_once lines for byte_safe_strings.php, cast_to_int.php and error_polyfill.php to a backslash instead of a forward slash seems to have resolved my issue. I'm guessing the IF THEN ELSE flow of code execution, from the perspective of Wordpress, ends up not executing other code that potentially also has slash direction mixing issues in path strings.

$RandomCompatDIR is set equal to "dirname(__FILE__)" which correctly handles the slash direct for *Nix and Windows according to PHP Docs.

This article on http://stackoverflow.com/questions/1959772/proper-way-to-set-php-include-path-for-nix-and-windows talks about this issue and indicates the use of the predefined constant DIRECTORY_SEPARATOR as THE solution -- again although some postings in the PHP DOC indicate the slash direction does not matter.

So I changed the three lines to:

require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'byte_safe_strings.php';
require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'cast_to_int.php';
require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'error_polyfill.php';

thus far all is well with Wordpress with PHP on Windows! I'll be monitoring the PHP error log over the next few days to see if more errors pop-up.

@paragonie-scott
Copy link
Member

The next release should have this fixed (which I'll tag today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants