PageRenderTime 55ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/mysql/tests/mysql_stat.php

http://github.com/facebook/hiphop-php
PHP | 37 lines | 26 code | 11 blank | 0 comment | 10 complexity | 919ccc43a97551e9e9281c6a808c0894 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. include_once "connect.inc";
  3. $dbname = 'test';
  4. $tmp = NULL;
  5. $link = NULL;
  6. if (!is_null($tmp = @mysql_stat($link)))
  7. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  8. require('table.inc');
  9. if (!is_null($tmp = @mysql_stat($link, "foo")))
  10. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  11. if ((!is_string($stat = mysql_stat($link))) || ('' === $stat))
  12. printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n",
  13. gettype($stat), $stat, mysql_errno($link), mysql_error($link));
  14. if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($stat)) {
  15. printf("[004] Expecting Unicode error message!\n");
  16. var_inspect($stat);
  17. }
  18. if ((!is_string($stat_def = mysql_stat())) || ('' === $stat_def))
  19. printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n",
  20. gettype($stat_def), $stat_def, mysql_errno(), mysql_error());
  21. assert(soundex($stat) === soundex($stat_def));
  22. mysql_close($link);
  23. if (false !== ($tmp = mysql_stat($link)))
  24. printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
  25. print "done!";
  26. ?>