posix_setuid_variation4.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test function posix_setuid() by substituting argument 1 with float values.
  3. --SKIPIF--
  4. <?php
  5. PHP_INT_SIZE == 4 or die("skip - 32-bit only");
  6. if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
  7. if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
  8. ?>
  9. --CREDITS--
  10. Marco Fabbri mrfabbri@gmail.com
  11. Francesco Fullone ff@ideato.it
  12. #PHPTestFest Cesena Italia on 2009-06-20
  13. --FILE--
  14. <?php
  15. echo "*** Test substituting argument 1 with float values ***\n";
  16. $myUid = posix_getuid();
  17. $myUid = $myUid - 1.1;
  18. $variation_array = array(
  19. 'float '.$myUid => $myUid,
  20. 'float -'.$myUid => -$myUid,
  21. 'float 12.3456789000e10' => 12.3456789000e10,
  22. 'float -12.3456789000e10' => -12.3456789000e10,
  23. 'float .5' => .5,
  24. );
  25. foreach ( $variation_array as $var ) {
  26. var_dump(posix_setuid( $var ) );
  27. }
  28. ?>
  29. --EXPECTF--
  30. *** Test substituting argument 1 with float values ***
  31. bool(false)
  32. bool(false)
  33. Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
  34. bool(false)
  35. Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
  36. bool(false)
  37. bool(false)