PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 65 lines | 50 code | 14 blank | 1 comment | 14 complexity | b98e2126a638e6270451650b90a76ef8 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. @ob_clean();
  4. ob_start();
  5. phpinfo();
  6. $phpinfo = ob_get_contents();
  7. ob_end_clean();
  8. /* all versions should at least dump this minimum information */
  9. if (!stristr($phpinfo, "mysql support"))
  10. printf("[001] ext/mysql should have exposed itself.\n");
  11. if (!stristr($phpinfo, "client api version"))
  12. printf("[002] ext/mysql should have exposed the library version.\n");
  13. if (!stristr($phpinfo, "mysql.default_host"))
  14. printf("[003] php.ini setting mysql.default_host not shown.\n");
  15. if (!stristr($phpinfo, "mysql.default_port"))
  16. printf("[004] php.ini setting mysql.default_port not shown.\n");
  17. if (!stristr($phpinfo, "mysql.default_password"))
  18. printf("[005] php.ini setting mysql.default_password not shown.\n");
  19. if (!stristr($phpinfo, "mysql.default_socket"))
  20. printf("[006] php.ini setting mysql.default_socket not shown.\n");
  21. if (!stristr($phpinfo, "mysql.default_user"))
  22. printf("[007] php.ini setting mysql.default_user not shown.\n");
  23. if (!stristr($phpinfo, "mysql.max_links"))
  24. printf("[008] php.ini setting mysql.max_links not shown.\n");
  25. if (!stristr($phpinfo, "mysql.max_persistent"))
  26. printf("[009] php.ini setting mysql.max_persistent not shown.\n");
  27. if (!stristr($phpinfo, "mysql.connect_timeout"))
  28. printf("[010] php.ini setting mysql.connect_timeout not shown.\n");
  29. if (!stristr($phpinfo, "mysql.allow_persistent"))
  30. printf("[011] php.ini setting mysql.allow_persistent not shown.\n");
  31. if ($IS_MYSQLND) {
  32. $expected = array(
  33. 'mysqlnd statistics',
  34. 'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
  35. 'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
  36. 'non_result_set_queries', 'no_index_used', 'bad_index_used',
  37. 'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
  38. 'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
  39. 'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
  40. 'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
  41. 'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
  42. 'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
  43. 'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
  44. 'size',
  45. );
  46. foreach ($expected as $k => $entry)
  47. if (!stristr($phpinfo, $entry))
  48. printf("[012] Could not find entry for '%s'\n", $entry);
  49. }
  50. print "done!";
  51. ?>