php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24628 missing space
Submitted: 2003-07-12 19:41 UTC Modified: 2003-07-13 20:02 UTC
From: prof_moriarty at veryfast dot biz Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.2 OS: win98
Private report: No CVE-ID: None
 [2003-07-12 19:41 UTC] prof_moriarty at veryfast dot biz
Description:
------------
Exeptionally minor bug, but a bug nonetheless.
mysql_stat, documentation says that the resulting string should be explodable into 7 elements

However in reality it can only be broken up into 6 elements.

It's broken up using double space. I've used preg_replace, and explode, and either way i only get 6 results when splitting via double space "  ".

Basically, there's a missing space in the output, between the end of 'open tables', and the start of 'queries per sec'.

Shouldn't take a fraction of a sec to fix. :)

Reproduce code:
---------------
var_dump(explode('  ', mysql_stat()));

Expected result:
----------------
Array
(
    [0] => Uptime: 5380
    [1] => Threads: 2
    [2] => Questions: 1321299
    [3] => Slow queries: 0
    [4] => Opens: 26
    [5] => Flush tables: 1
    [6] => Open tables: 17
    [7] => Queries per second avg: 245.595
)

Actual result:
--------------
array(7) {
  [0]=>
  string(12) "Uptime: 6910"
  [1]=>
  string(10) "Threads: 2"
  [2]=>
  string(15) "Questions: 2229"
  [3]=>
  string(15) "Slow queries: 0"
  [4]=>
  string(9) "Opens: 77"
  [5]=>
  string(15) "Flush tables: 1"
  [6]=>
  string(45) "Open tables: 13 Queries per second avg: 0.323"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-12 21:07 UTC] sniper@php.net
Mysql problem. (we just print out whatever mysql returns)

 [2003-07-13 06:03 UTC] prof_moriarty at veryfast dot biz
I'm not so sure it is.
So far as i can tell, mysql_stat simply shows a few of what "SHOW STATUS" does in mysql.

However "show status" doesn't show a "Queries per second avg:", only mysql_stat does.

So i'd hazard a guess that it's php that works out the query counter, and then adds it to the list, but with only 1 space after the last entry.
 [2003-07-13 10:31 UTC] sniper@php.net
But I am sure it's a mysql bug. RTFS if you don't believe me.


 [2003-07-13 10:32 UTC] sniper@php.net
To be precise: I KNOW it's mysql "bug".

 [2003-07-13 13:59 UTC] prof_moriarty at veryfast dot biz
call me finicky if you want, but i've reported 2 bugs in the past two days.
1 reply included "RTFM" (http://bugs.php.net/bug.php?id=24633&edit=2),
and now you're using RTFS

Having had to google them both, i'm rather disturbed that so many peeps contributing to the source have to use acronyms that include expletives!!!

Come to think of it, of the last 3 bugs i've reported, all the replies were less than savory... Why the hell do people bother reporting them? I know in the future i won't bother wasting my time trying to help.

As to RTFSing: I would, but i don't have a copy of it, nor would i be able to understand a copy of it if i aquired one. (C(++) isn't on my skill list).
 [2003-07-13 14:27 UTC] sniper@php.net
Heh..bad luck I guess. Don't take it personally, we use acronyms because we don't know any better. :)
(Also, for most of us english is not our native language, for example I had to look for "finicky" and "expletive" in my dictionary :)

It's not helping us if people report things as bugs, even as they're a) not our fault (like this mysql thing) b) not real bugs (and even documented as not being such).

Whenever you suspect there's a bug, do your homework first before submitting any reports. That way you save our and your time. First thing to do is to ask on some mailing list  if anybody else is having same problem. Then if someone says they are and that they also think it's a bug, search the bug database for possible existing report.
If you can't find an existing report in any catogory or with any status (bogus included :), then provide a complete report with enough information (but not too much either).

Then you're helping and not wasting our time.
Thank you for using PHP anyway. :)

 [2003-07-13 16:09 UTC] prof_moriarty at veryfast dot biz
acronyms are fine. Just try to miss out the F's in them. :)

Pertaining to the bug: I spent a full 12 mins downloading the PHP source code (56k), managed to find 'mysql_stat', and could make absolutely no sense whatsoever of what the code said. :( So RTSC wasn't much good.

At least i've had the opportunity to broaden someones linguistical horizons. :)
 [2003-07-13 17:42 UTC] sniper@php.net
This line (ext/mysql/php_mysql.c:1060 or so) is where
the 'magic' happens:

    RETURN_STRING((char *)mysql_stat(&mysql->conn), 1);

This is what mysql_stat() (PHP function) returns.
It's exactly the same data what the mysql_stat() (libmysqlclient C function) returns.

And btw. the F in RTFM/RTFS means "friendly" :)


 [2003-07-13 20:02 UTC] prof_moriarty at veryfast dot biz
I figured it was that line (the "return" gives it away), just don't understand the stuff it's actually returning. :)

And for some reason google didn't seem to think F stood for friendly. Maybe someone should complain to google support... ;)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 13:01:31 2024 UTC