utf8_encode_error.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Test utf8_encode() function : error conditions
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("xml")) {
  6. print "skip - XML extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /* Prototype : proto string utf8_encode(string data)
  12. * Description: Encodes an ISO-8859-1 string to UTF-8
  13. * Source code: ext/xml/xml.c
  14. * Alias to functions:
  15. */
  16. echo "*** Testing utf8_encode() : error conditions ***\n";
  17. // Zero arguments
  18. echo "\n-- Testing utf8_encode() function with Zero arguments --\n";
  19. var_dump( utf8_encode() );
  20. //Test utf8_encode with one more than the expected number of arguments
  21. echo "\n-- Testing utf8_encode() function with more than expected no. of arguments --\n";
  22. $data = 'string_val';
  23. $extra_arg = 10;
  24. var_dump( utf8_encode($data, $extra_arg) );
  25. echo "Done";
  26. ?>
  27. --EXPECTF--
  28. *** Testing utf8_encode() : error conditions ***
  29. -- Testing utf8_encode() function with Zero arguments --
  30. Warning: utf8_encode() expects exactly 1 parameter, 0 given in %s on line %d
  31. NULL
  32. -- Testing utf8_encode() function with more than expected no. of arguments --
  33. Warning: utf8_encode() expects exactly 1 parameter, 2 given in %s on line %d
  34. NULL
  35. Done