convert_uudecode_variation1.phpt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. --TEST--
  2. Test convert_uudecode() function : usage variations - test values for $data argument
  3. --FILE--
  4. <?php
  5. /* Prototype : string convert_uudecode ( string $data )
  6. * Description: Decode a uuencoded string
  7. * Source code: ext/standard/uuencode.c
  8. */
  9. echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\n";
  10. //get an unset variable
  11. $unset_var = 'string_val';
  12. unset($unset_var);
  13. //defining a class
  14. class sample {
  15. public function __toString() {
  16. return "sample object";
  17. }
  18. }
  19. //getting the resource
  20. $file_handle = fopen(__FILE__, "r");
  21. // array with different values for $data
  22. $inputs = array (
  23. // integer values
  24. /*1*/ 0,
  25. 1,
  26. 255,
  27. 256,
  28. 2147483647,
  29. -2147483648,
  30. // float values
  31. /*7*/ 10.5,
  32. -20.5,
  33. 10.1234567e10,
  34. // array values
  35. /*10*/ array(),
  36. array(0),
  37. array(1, 2),
  38. // boolean values
  39. /*13*/ true,
  40. false,
  41. TRUE,
  42. FALSE,
  43. // null values
  44. /*17*/ NULL,
  45. null,
  46. // objects
  47. /*19*/ new sample(),
  48. // resource
  49. /*20*/ $file_handle,
  50. // undefined variable
  51. /*21*/ @$undefined_var,
  52. // unset variable
  53. /*22*/ @$unset_var
  54. );
  55. // loop through with each element of the $data array to test convert_uudecode() function
  56. $count = 1;
  57. foreach($inputs as $input) {
  58. echo "-- Iteration $count --\n";
  59. var_dump( convert_uudecode($input) );
  60. $count ++;
  61. }
  62. fclose($file_handle); //closing the file handle
  63. ?>
  64. ===DONE===
  65. --EXPECTF--
  66. *** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***
  67. -- Iteration 1 --
  68. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  69. bool(false)
  70. -- Iteration 2 --
  71. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  72. bool(false)
  73. -- Iteration 3 --
  74. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  75. bool(false)
  76. -- Iteration 4 --
  77. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  78. bool(false)
  79. -- Iteration 5 --
  80. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  81. bool(false)
  82. -- Iteration 6 --
  83. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  84. bool(false)
  85. -- Iteration 7 --
  86. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  87. bool(false)
  88. -- Iteration 8 --
  89. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  90. bool(false)
  91. -- Iteration 9 --
  92. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  93. bool(false)
  94. -- Iteration 10 --
  95. Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
  96. bool(false)
  97. -- Iteration 11 --
  98. Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
  99. bool(false)
  100. -- Iteration 12 --
  101. Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
  102. bool(false)
  103. -- Iteration 13 --
  104. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  105. bool(false)
  106. -- Iteration 14 --
  107. bool(false)
  108. -- Iteration 15 --
  109. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  110. bool(false)
  111. -- Iteration 16 --
  112. bool(false)
  113. -- Iteration 17 --
  114. bool(false)
  115. -- Iteration 18 --
  116. bool(false)
  117. -- Iteration 19 --
  118. Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
  119. bool(false)
  120. -- Iteration 20 --
  121. Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d
  122. bool(false)
  123. -- Iteration 21 --
  124. bool(false)
  125. -- Iteration 22 --
  126. bool(false)
  127. ===DONE===