Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test dirname() function : usage variations --SKIPIF-- <?php if((substr(PHP_OS, 0,..

Decoded Output download

--TEST--
Test dirname() function : usage variations
--SKIPIF--
<?php
if((substr(PHP_OS, 0, 3) == "WIN"))
  die('skip not for Windows');
?>
--FILE--
<?php
for ($i=0 ; $i<5 ; $i++) {
    try {
        var_dump(dirname("/foo/bar/baz", $i));
    } catch (\ValueError $e) {
        echo $e->getMessage() . "
";
    }
}
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
?>
--EXPECT--
dirname(): Argument #2 ($levels) must be greater than or equal to 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "/"
string(1) "/"
string(1) "/"

Did this file decode correctly?

Original Code

--TEST--
Test dirname() function : usage variations
--SKIPIF--
<?php
if((substr(PHP_OS, 0, 3) == "WIN"))
  die('skip not for Windows');
?>
--FILE--
<?php
for ($i=0 ; $i<5 ; $i++) {
    try {
        var_dump(dirname("/foo/bar/baz", $i));
    } catch (\ValueError $e) {
        echo $e->getMessage() . "\n";
    }
}
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
?>
--EXPECT--
dirname(): Argument #2 ($levels) must be greater than or equal to 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "/"
string(1) "/"
string(1) "/"

Function Calls

None

Variables

None

Stats

MD5 fdc9e1bc8da0e6159cdedb9ad7d4fc80
Eval Count 0
Decode Time 100 ms