Skip to content

Instantly share code, notes, and snippets.

@kanonji
Created April 4, 2011 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanonji/902212 to your computer and use it in GitHub Desktop.
Save kanonji/902212 to your computer and use it in GitHub Desktop.
test for file_exists() is binary safe or not.
If you see that this file is exist, file_exists() is not binary safe.
<?php
define( 'DIR', dirname(__FILE__).DIRECTORY_SEPARATOR );
$file = "file_exists-is-not-binary-safe.txt\0";
var_dump( file_exists( DIR.$file.'.php' )); //if true, file_exists() is not binary safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment