WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
Uname:Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64

Base Dir : /var/www/eduesan

User : www-data


403WebShell
403Webshell
Server IP : 202.131.237.196  /  Your IP : 216.73.216.192
Web Server : nginx/1.14.0
System : Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.2.24-0ubuntu0.18.04.17
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/php/72/src/ext/standard/tests/file/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/php/72/src/ext/standard/tests/file/fgetc_variation4.phpt
--TEST--
Test fgetc() function : usage variations - different read modes
--FILE--
<?php
/*
 Prototype: string fgetc ( resource $handle );
 Description: Gets character from file pointer
*/

/* read from fie using fgetc, file opened using different
   read read modes */

echo "*** Testing fgetc() : usage variations ***\n";
echo "-- Testing fgetc() with files opened with different read modes --\n";

$file_modes = array( "a+", "a+b", "a+t",
                     "x+", "x+b", "x+t",
                     "w+", "w+b", "w+t" );

$filename = dirname(__FILE__)."/fgetc_variation4.tmp";
foreach ($file_modes as $file_mode ) {
  echo "-- File opened in mode : $file_mode --\n";

  $file_handle = fopen($filename, $file_mode);
  if(!$file_handle) {
    echo "Error: failed to open file $filename!\n";
    exit();
  }
  $data = "fgetc\n test";
  fwrite($file_handle, $data);

  // rewind the file pointer to beginning of the file
  var_dump( rewind($file_handle) );
  var_dump( ftell($file_handle) );
  var_dump( feof($file_handle) );

  // read from file, at least 7 chars
  for($counter =0; $counter < 7; $counter ++) {
    var_dump( fgetc($file_handle) ); // expected : 1 char
    var_dump( ftell($file_handle) );
    var_dump( feof($file_handle) ); // check if end of file pointer is set
  }

  // close the file
  fclose($file_handle);

  // delete the file
  unlink($filename);
}

echo "Done\n";
?>
--EXPECTF--
 *** Testing fgetc() : usage variations ***
-- Testing fgetc() with files opened with different read modes --
-- File opened in mode : a+ --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : a+b --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : a+t --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : x+ --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : x+b --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : x+t --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : w+ --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : w+b --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
-- File opened in mode : w+t --
bool(true)
int(0)
bool(false)
string(1) "f"
int(1)
bool(false)
string(1) "g"
int(2)
bool(false)
string(1) "e"
int(3)
bool(false)
string(1) "t"
int(4)
bool(false)
string(1) "c"
int(5)
bool(false)
string(1) "
"
int(6)
bool(false)
string(1) " "
int(7)
bool(false)
Done

Youez - 2016 - github.com/yon3zu
LinuXploit