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 fileinode() function: usage variations - invalid filenames --CREDITS-- Dave ..

Decoded Output download

--TEST--
Test fileinode() function: usage variations - invalid filenames
--CREDITS--
Dave Kelsey <[email protected]>
--CONFLICTS--
obscure_filename
--FILE--
<?php
/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */

$file_path = __DIR__;

echo "*** Testing Invalid file types ***
";
$filenames = array(
  /* Invalid filenames */
  -2.34555,
  " ",
  "",
  TRUE,
  FALSE,

  /* scalars */
  1234,
  0
);

/* loop through to test each element the above array */
foreach( $filenames as $filename ) {
  var_dump( fileinode($filename) );
  clearstatcache();
}
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink($file_path."/fileinode_variation2.tmp");
?>
--EXPECTF--
*** Testing Invalid file types ***

Warning: fileinode(): stat failed for -2.34555 in %s on line %d
bool(false)

Warning: fileinode(): stat failed for   in %s on line %d
bool(false)
bool(false)

Warning: fileinode(): stat failed for 1 in %s on line %d
bool(false)
bool(false)

Warning: fileinode(): stat failed for 1234 in %s on line %d
bool(false)

Warning: fileinode(): stat failed for 0 in %s on line %d
bool(false)

Did this file decode correctly?

Original Code

--TEST--
Test fileinode() function: usage variations - invalid filenames
--CREDITS--
Dave Kelsey <[email protected]>
--CONFLICTS--
obscure_filename
--FILE--
<?php
/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */

$file_path = __DIR__;

echo "*** Testing Invalid file types ***\n";
$filenames = array(
  /* Invalid filenames */
  -2.34555,
  " ",
  "",
  TRUE,
  FALSE,

  /* scalars */
  1234,
  0
);

/* loop through to test each element the above array */
foreach( $filenames as $filename ) {
  var_dump( fileinode($filename) );
  clearstatcache();
}
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink($file_path."/fileinode_variation2.tmp");
?>
--EXPECTF--
*** Testing Invalid file types ***

Warning: fileinode(): stat failed for -2.34555 in %s on line %d
bool(false)

Warning: fileinode(): stat failed for   in %s on line %d
bool(false)
bool(false)

Warning: fileinode(): stat failed for 1 in %s on line %d
bool(false)
bool(false)

Warning: fileinode(): stat failed for 1234 in %s on line %d
bool(false)

Warning: fileinode(): stat failed for 0 in %s on line %d
bool(false)

Function Calls

None

Variables

None

Stats

MD5 28527de6e62cbe5743a107b8db7588e1
Eval Count 0
Decode Time 94 ms