PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/mysqli/tests/mysqli_report_wo_ps.phpt ('mysqli_report(), MySQL < 5.6')

Script

1: <?php
2:     
require_once("connect.inc");
3:
4:     
$tmp    NULL;
5:     
$link   NULL;
6:
7:     if (
NULL !== ($tmp = @mysqli_report()))
8:         
printf("[001] Expecting NULL, got %s/%s\n"gettype($tmp), $tmp);
9:
10:     if (
true !== ($tmp mysqli_report(-1)))
11:         
printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n"gettype($tmp), $tmp);
12:
13:     if (
true !== ($tmp mysqli_report(MYSQLI_REPORT_ERROR)))
14:         
printf("[003] Expecting boolean/true, got %s/%s\n"gettype($tmp), $tmp);
15:
16:     if (
true !== ($tmp mysqli_report(MYSQLI_REPORT_STRICT)))
17:         
printf("[004] Expecting boolean/true, got %s/%s\n"gettype($tmp), $tmp);
18:
19:     if (
true !== ($tmp mysqli_report(MYSQLI_REPORT_INDEX)))
20:         
printf("[005] Expecting boolean/true, got %s/%s\n"gettype($tmp), $tmp);
21:
22:     if (
true !== ($tmp mysqli_report(MYSQLI_REPORT_ALL)))
23:         
printf("[007] Expecting boolean/true, got %s/%s\n"gettype($tmp), $tmp);
24:
25:     if (
true !== ($tmp mysqli_report(MYSQLI_REPORT_OFF)))
26:         
printf("[008] Expecting boolean/true, got %s/%s\n"gettype($tmp), $tmp);
27:
28:     require(
'table.inc');
29:
30:     
/*
31:     Internal macro MYSQL_REPORT_ERROR
32:     */
33:     
mysqli_report(MYSQLI_REPORT_ERROR);
34:
35:     
mysqli_multi_query($link"BAR; FOO;");
36:     
mysqli_query($link"FOO");
37:     
mysqli_change_user($link"0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789""password"$db);
38:     
mysqli_kill($link, -1);
39:
40:     
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
41:     
mysqli_real_query($link"FOO");
42:     if (@
mysqli_select_db($link"Oh lord, let this be an unknown database name"))
43:         
printf("[009] select_db should have failed\n");
44:     
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
45:
46:
47:     // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
48:     // not have been set. If that would be the case, the test would be broken.
49:     
mysqli_report(MYSQLI_REPORT_OFF);
50:
51:     
mysqli_multi_query($link"BAR; FOO;");
52:     
mysqli_query($link"FOO");
53:     
mysqli_change_user($link"This might work if you accept anonymous users in your setup""password"$db);
54:     
mysqli_kill($link, -1);
55:     
mysqli_real_query($link"FOO");
56:     
mysqli_select_db($link"Oh lord, let this be an unknown database name");
57:
58:     
mysqli_report(MYSQLI_REPORT_OFF);
59:     
mysqli_report(MYSQLI_REPORT_STRICT);
60:
61:     try {
62:
63:         if (
$link my_mysqli_connect($host$user 'unknown_really'$passwd 'non_empty'$db$port$socket))
64:             
printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
65:                 
$host$user 'unknown_really'$db$port$socket);
66:         
mysqli_close($link);
67:
68:     } catch (
mysqli_sql_exception $e) {
69:         
printf("[011] %s\n"$e->getMessage());
70:     }
71:
72:     try {
73:         if (!
$link mysqli_init())
74:             
printf("[012] [%d] %s\n"mysqli_connect_errno(), mysqli_connect_error());
75:
76:         if (
$link my_mysqli_real_connect($link$host$user 'unknown_really'$passwd 'non_empty'$db$port$socket))
77:             
printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
78:                 
$host$user 'unknown_really'$db$port$socket);
79:         
mysqli_close($link);
80:     } catch (
mysqli_sql_exception $e) {
81:         
printf("[014] %s\n"$e->getMessage());
82:     }
83:
84:     print 
"done!";
85:
?>
86:

Expected

Warning: mysqli_multi_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'BAR; FOO' at line 1 in %s on line %d

Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d

Warning: mysqli_change_user(): (%d/%d): Access denied for user '%s'@'%s' (using password: %s) in %s on line %d

Warning: mysqli_kill(): processid should have positive value in %s on line %d

Warning: mysqli_real_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d

Warning: mysqli_kill(): processid should have positive value in %s on line %d
[011] Access denied for user '%s'@'%s' (using password: YES)
[014] Access denied for user '%s'@'%s' (using password: YES)
done!

Output

Fatal error: Uncaught ArgumentCountError: mysqli_report() expects exactly 1 parameter, 0 given in /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php:7
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php(7): mysqli_report()
#1 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php on line 7

Diff

001+ Fatal error: Uncaught ArgumentCountError: mysqli_report() expects exactly 1 parameter, 0 given in /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php:7
002+ Stack trace:
003+ #0 /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php(7): mysqli_report()
004+ #1 {main}
005+   thrown in /var/php_gcov/PHP_HEAD/ext/mysqli/tests/mysqli_report_wo_ps.php on line 7
001- Warning: mysqli_multi_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'BAR; FOO' at line 1 in %s on line %d
002- 
003- Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
004- 
005- Warning: mysqli_change_user(): (%d/%d): Access denied for user '%s'@'%s' (using password: %s) in %s on line %d
006- 
007- Warning: mysqli_kill(): processid should have positive value in %s on line %d
008- 
009- Warning: mysqli_real_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
010- 
011- Warning: mysqli_kill(): processid should have positive value in %s on line %d
012- [011] Access denied for user '%s'@'%s' (using password: YES)
013- [014] Access denied for user '%s'@'%s' (using password: YES)
014- done!

 

Generated at Mon, 06 May 2019 17:58:35 +0000 (942 days ago)

Copyright © 2005-2021 The PHP Group
All rights reserved.