Skip to content

Instantly share code, notes, and snippets.

@blar
Created January 25, 2016 20:30
Show Gist options
  • Save blar/4d4fe59e2453ae845f7d to your computer and use it in GitHub Desktop.
Save blar/4d4fe59e2453ae845f7d to your computer and use it in GitHub Desktop.
realpath mit strict_types
<?php
declare(strict_types = 1);
$path = 'foobar';
var_dump($path);
$path = realpath($path);
var_dump($path);
$path = realpath($path);
var_dump($path);
string(6) "foobar"
bool(false)
Fatal error: Uncaught TypeError: realpath() expects parameter 1 to be a valid path, boolean given in -:11
Stack trace:
#0 -(11): realpath(false)
#1 {main}
thrown in - on line 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment