Menu

#321 JpGraph: DB::isError() should not be called statically

v1.0rc4
open
nobody
None
3
2005-09-21
2005-05-28
No

After installing phpbt 1.0rc5 and JpGraph 2.0beta on my
PHP5 server, I got the following error on phpbt main
page:

JpGraph Error General PHP error: Non-static method DB
::isError() should not be called statically

I fixed this by doing following changes:

/include.php, line 52, change
if (DB::isError($db)) {
to
if ($db->isError($db)) {

/upgrade.php, line 34, change
if (!$upgraded or DB::isError($thisvers)) {
to
if (!$upgraded or $db->isError($thisvers)) {

Seems to work for now.

Discussion

  • Ulf Erikson

    Ulf Erikson - 2005-05-28

    Logged In: YES
    user_id=592447

    I think DB::isError is supposed to be static.

    If you say that you know that phpBT is at fault and not your
    version of Pear:Db I'll ask Benjamin to take a look at this.
    As far as I see it your "$db->isError($db)" will not work
    correctly. (there is no isError in class DB_Error. once you
    have an error you will call a non-existing function)

     
  • Markus Birth

    Markus Birth - 2005-05-29

    Logged In: YES
    user_id=701876

    I don't know how it is programmed in the PHP5-Pear:Db as I
    only have FTP access to my server - and only in my directory.
    But I wanted phpBT to work and it works now.

    I'd appreciate any better (and more working) bugfix.

     
  • Ulf Erikson

    Ulf Erikson - 2005-09-21
    • priority: 5 --> 3
     
  • Kerfred

    Kerfred - 2006-07-12

    Logged In: YES
    user_id=1554333

    I had the same problem.
    It comes from PEAR:DB on Windows.

    To fix it, I modified the file php\PEAR\pear\DB.php by
    adding "static" before the functions "isError" and "connect".
    There is nothing to change in phpBT.

     
  • Flohack

    Flohack - 2006-08-30

    Logged In: YES
    user_id=304752

    had the same Problem....

    is this a PHP interpreter error, because there is no obvious
    reason for this happening?

    BTW kerfred´s solution seems the best, only a minor change
    in the PEAR libs, changing all to instances in the phpbt
    project is much more complicated.
    regards, FL

     
  • Kerfred

    Kerfred - 2006-08-30

    Logged In: YES
    user_id=1554333

    It comes from PEAR:DB on Windows which is compatible with
    PHP4 but not with PHP5. PHP5 needs the "static" keyword
    before static methods and variables, whereas this keyword
    does not exist in PHP4.
    The solution is to add "static" before all static methods in
    the file php\PEAR\pear\DB.php.

     
  • Bryce Nesbitt

    Bryce Nesbitt - 2007-09-16

    Logged In: YES
    user_id=122507
    Originator: NO

    DB::isError is documented as static. Googling shows lots of people with this problem.
    Try
    ------------------------
    $db = new DB();
    $db = $db->Connect($dsn);
    if ($db->isError($db)) {
    die($db->message.'<br>'.$db->userinfo);
    }
    -------------------------

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.