php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #22005 mysql_stat space problems
Submitted: 2003-02-01 21:26 UTC Modified: 2005-01-26 20:28 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: haafiz at ezwebsolutions dot ca Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0 OS: ALL
Private report: No CVE-ID: None
 [2003-02-01 21:26 UTC] haafiz at ezwebsolutions dot ca
When I call mysql_stat(), it returns a string like this:

Uptime: 1182208  Threads: 13  Questions: 745284  Slow queries: 1  Opens: 2210  Flush tables: 1  Open tables: 12 Queries per second avg: 0.630

All the fields are supposed to have two spaces ("  ") between each of them so that an explode() will work on it.

However, you will notice that there is only 1 space (" ") between the value of "Open Tables" and the caption "Queries per second avg:"

Is this how it is supposed to be? Or is this a minor bug?

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-02 03:23 UTC] nicos@php.net
In fact there are more space but the HTML output will read only one. Use explode('[[:space:]]',$var) to divide it.

(You can verify that by looking at the HTML source.
 [2003-02-02 11:32 UTC] philip@php.net
a) split/preg_split uses regex, not explode
b) it would not work well as it'd split up everything
c) this is not related to html but rather a php string
d) the example in the manual uses explode on two spaces

If this is indeed true (one space before Queries) than this is a bug ... somewhere.
 [2003-02-03 06:05 UTC] nicos@php.net
Ok, this is verified but this is not a PHP's bug, but a MySQL's. Please post a MySQL's bug.
 [2003-02-03 07:17 UTC] georg@php.net
Reclassified as a documentation bug

 [2003-06-02 09:41 UTC] mike at pcmedx dot com
I also added this workaround to the doc page.

$stat = explode('  ',mysql_stat($this->c_id));
list($stat[6],$stat[7]) = preg_split('/\s(Q.+)/',$stat[6],-1,PREG_SPLIT_DELIM_CAPTURE);
 [2005-01-26 20:28 UTC] philip@php.net
If this was a MySQL bug it isn't listed in their Bug DB (so I can't offer my information) but anyway I added an alternate example (that parses SHOW STATUS) in the manual. Also, this bug is old and cosmetic. Status->closed.

Here's the diff:
http://cvs.php.net/diff.php/phpdoc/en/reference/mysql/functions/mysql-stat.xml?r1=1.8&r2=1.10

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 15 20:01:27 2024 UTC