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/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt ('PDO::ATTR_SERVER_INFO')

Script

1: <?php
2:     
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR 'mysql_pdo_test.inc');
3:     
$db MySQLPDOTest::factory();
4:
5:     
assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
6:
7:     
$info $db->getAttribute(PDO::ATTR_SERVER_INFO);
8:     if (
'' == $info)
9:         
printf("[001] Server info must not be empty\n");
10:
11:     
// Read-only?
12:     
if (false !== $db->setAttribute(PDO::ATTR_SERVER_INFO'new uptime: 0s'))
13:         
printf("[002] Wonderful, I can change the client version!\n");
14:
15:     
$new_info $db->getAttribute(PDO::ATTR_SERVER_INFO);
16:     if (
soundex($new_info) != soundex($info))
17:         
printf("[003] Did we change it from '%s' to '%s'?\n"$info$info);
18:
19:     
// lets hope we always run this in the same second as we did run the server info request...
20:     
if (!$stmt $db->query("SHOW STATUS LIKE '%uptime%'"))
21:         
printf("[004] Cannot run SHOW STATUS, [%s]\n"$db->errorCode());
22:     else {
23:         if (!
$row $stmt->fetch(PDO::FETCH_NUM))
24:             
printf("[005] Unable to fetch uptime, [%s]\n"$db->errorCode());
25:         else
26:             
$uptime $row[1];
27:         
$stmt->closeCursor();
28:     }
29:
30:     if (!
preg_match('/Uptime/i'$info))
31:         
printf("[006] Can't find uptime in server info '%s'\n"$info);
32:
33:     if (isset(
$uptime) && !preg_match(sprintf('/Uptime: %d/i'$uptime), $info))
34:         
printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n"$info$uptime);
35:
36:     print 
"done!";
37:

Expected

done!

Output

[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: 'Uptime: 2519861  Threads: 1  Questions: 575197  Slow queries: 0  Opens: 45197  Flush tables: 1  Open tables: 14  Queries per second avg: 0.228', SHOW STATUS: '2519862'
done!

Diff

001+ [007] SHOW STATUS and server info have reported a different uptime, please check. Server info: 'Uptime: 2519861  Threads: 1  Questions: 575197  Slow queries: 0  Opens: 45197  Flush tables: 1  Open tables: 14  Queries per second avg: 0.228', SHOW STATUS: '2519862'

 

Generated at Sat, 13 Dec 2014 06:16:29 +0000 (6 days ago)

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