posix_setuid_variation3.phpt 1.1 KB

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