Professional Web Applications Themes

#38947 [NEW]: Unable to extend mysqli class properly without causing various fatal errors - PHP Bugs

From: rk at yes-co dot nl Operating system: Debian PHP version: 5.1.6 PHP Bug Type: MySQLi related Bug description: Unable to extend mysqli class properly without causing various fatal errors Description: ------------ Problem with extension of mysqli library. Reproduce code: --------------- <?php //loaded mysql via dl() function $server = 'localhost'; $dbname = 'ws_matching'; $username = 'root'; $password = ''; $port = 3306; $socket = '/tmp/mysql.sock'; class example_mysqli extends mysqli{ function query($query){ $result = parent::query($query); if(mysqli_error($this)){ throw new exception(mysqli_error($this), mysqli_errno($this)); } return $result; } } //$my = new mysqli($server,$username,$password,$dbname,$port,$ socket); //works properly $my = new example_mysqli($server,$username,$password, $dbname,$port,$socket); //gives strange errors $result ...

  1. #1

    Default #38947 [NEW]: Unable to extend mysqli class properly without causing various fatal errors

    From: rk at yes-co dot nl
    Operating system: Debian
    PHP version: 5.1.6
    PHP Bug Type: MySQLi related
    Bug description: Unable to extend mysqli class properly without causing various fatal errors

    Description:
    ------------
    Problem with extension of mysqli library.

    Reproduce code:
    ---------------
    <?php
    //loaded mysql via dl() function
    $server = 'localhost'; $dbname = 'ws_matching'; $username = 'root';
    $password = ''; $port = 3306; $socket = '/tmp/mysql.sock';
    class example_mysqli extends mysqli{
    function query($query){
    $result = parent::query($query);
    if(mysqli_error($this)){
    throw new exception(mysqli_error($this), mysqli_errno($this));
    }
    return $result;
    }
    }
    //$my = new mysqli($server,$username,$password,$dbname,$port,$ socket);
    //works properly
    $my = new example_mysqli($server,$username,$password,
    $dbname,$port,$socket); //gives strange errors
    $result = $my->query('SELECT * FROM housesnl_demand');
    while($row = $result->fetch_row()){
    print_r($row);
    }
    $result->close();
    $my->close();
    ?>

    Expected result:
    ----------------
    Array ( [0] => 2006-09-25 12:09:58 )

    Actual result:
    --------------
    possible fatal errors:

    Fatal error: mysqli_stmt::data_seek() must be derived from
    example_mysqli::data_seek in Unknown on line 0

    Fatal error: mysqli_stmt::bind_param() must be derived from
    example_mysqli::bind_param in Unknown on line 0


    Warning: Wrong parameter count for mysqli_stmt::mysqli_stmt() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php on
    line 19


    Fatal error: Call to undefined method mysqli_warning::query() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php on
    line 11

    etc... error changes

    --
    Edit bug report at [url]http://bugs.php.net/?id=38947&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=38947&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=38947&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=38947&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=38947&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=38947&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=38947&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=38947&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=38947&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=38947&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=38947&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=38947&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=38947&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=38947&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=38947&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=38947&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=38947&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=38947&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=38947&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=38947&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=38947&r=mysqlcfg[/url]
    rk at yes-co dot nl Guest

  2. #2

    Default #38947 [Opn->Bgs]: Unable to extend mysqli class properly without causing various fatal errors

    ID: 38947
    Updated by: [email]tony2001php.net[/email]
    Reported By: rk at yes-co dot nl
    -Status: Open
    +Status: Bogus
    Bug Type: MySQLi related
    Operating System: Debian
    PHP Version: 5.1.6
    New Comment:

    Parent constructor (parent::__construct()) must be called explicitly
    when extending MySQLi.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-25 10:14:05] rk at yes-co dot nl

    Description:
    ------------
    Problem with extension of mysqli library.

    Reproduce code:
    ---------------
    <?php
    //loaded mysql via dl() function
    $server = 'localhost'; $dbname = 'ws_matching'; $username = 'root';
    $password = ''; $port = 3306; $socket = '/tmp/mysql.sock';
    class example_mysqli extends mysqli{
    function query($query){
    $result = parent::query($query);
    if(mysqli_error($this)){
    throw new exception(mysqli_error($this), mysqli_errno($this));
    }
    return $result;
    }
    }
    //$my = new mysqli($server,$username,$password,$dbname,$port,$ socket);
    //works properly
    $my = new example_mysqli($server,$username,$password,
    $dbname,$port,$socket); //gives strange errors
    $result = $my->query('SELECT * FROM housesnl_demand');
    while($row = $result->fetch_row()){
    print_r($row);
    }
    $result->close();
    $my->close();
    ?>

    Expected result:
    ----------------
    Array ( [0] => 2006-09-25 12:09:58 )

    Actual result:
    --------------
    possible fatal errors:

    Fatal error: mysqli_stmt::data_seek() must be derived from
    example_mysqli::data_seek in Unknown on line 0

    Fatal error: mysqli_stmt::bind_param() must be derived from
    example_mysqli::bind_param in Unknown on line 0


    Warning: Wrong parameter count for mysqli_stmt::mysqli_stmt() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php
    on line 19


    Fatal error: Call to undefined method mysqli_warning::query() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php
    on line 11

    etc... error changes


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38947&edit=1[/url]
    tony2001@php.net Guest

  3. #3

    Default #38947 [Bgs]: Unable to extend mysqli class properly without causing various fatal errors

    ID: 38947
    User updated by: rk at yes-co dot nl
    Reported By: rk at yes-co dot nl
    Status: Bogus
    Bug Type: MySQLi related
    Operating System: Debian
    PHP Version: 5.1.6
    New Comment:

    I tried that first this is just a simple example of a more complex
    issue, even when parent constructor is called problems arise


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-09-25 10:19:24] [email]tony2001php.net[/email]

    Parent constructor (parent::__construct()) must be called explicitly
    when extending MySQLi.

    ------------------------------------------------------------------------

    [2006-09-25 10:14:05] rk at yes-co dot nl

    Description:
    ------------
    Problem with extension of mysqli library.

    Reproduce code:
    ---------------
    <?php
    //loaded mysql via dl() function
    $server = 'localhost'; $dbname = 'ws_matching'; $username = 'root';
    $password = ''; $port = 3306; $socket = '/tmp/mysql.sock';
    class example_mysqli extends mysqli{
    function query($query){
    $result = parent::query($query);
    if(mysqli_error($this)){
    throw new exception(mysqli_error($this), mysqli_errno($this));
    }
    return $result;
    }
    }
    //$my = new mysqli($server,$username,$password,$dbname,$port,$ socket);
    //works properly
    $my = new example_mysqli($server,$username,$password,
    $dbname,$port,$socket); //gives strange errors
    $result = $my->query('SELECT * FROM housesnl_demand');
    while($row = $result->fetch_row()){
    print_r($row);
    }
    $result->close();
    $my->close();
    ?>

    Expected result:
    ----------------
    Array ( [0] => 2006-09-25 12:09:58 )

    Actual result:
    --------------
    possible fatal errors:

    Fatal error: mysqli_stmt::data_seek() must be derived from
    example_mysqli::data_seek in Unknown on line 0

    Fatal error: mysqli_stmt::bind_param() must be derived from
    example_mysqli::bind_param in Unknown on line 0


    Warning: Wrong parameter count for mysqli_stmt::mysqli_stmt() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php
    on line 19


    Fatal error: Call to undefined method mysqli_warning::query() in
    /mnt/data/home/rob/public_html/MatchingRevised/strange_error_mysqli.php
    on line 11

    etc... error changes


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38947&edit=1[/url]
    rk at yes-co dot nl Guest

Similar Threads

  1. Replies: 1
    Last Post: October 4th, 03:10 AM
  2. Extend Date Class Flex 2 Beta 3
    By Chester Copperpot in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: May 17th, 06:12 PM
  3. [PHP] Q on Class and EXTEND
    By Jswalter in forum PHP Development
    Replies: 5
    Last Post: September 3rd, 05:42 PM
  4. Q on Class and EXTEND
    By Jswalter in forum PHP Development
    Replies: 0
    Last Post: September 3rd, 04:12 PM
  5. unable to extend table : bytes or blocks ??
    By zeb in forum Oracle Server
    Replies: 0
    Last Post: December 7th, 10:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139