FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=18978&edit=1

ID: 18978
Updated by: danielc@analysisandsolutions.com
Reported By: cameron dot moller at gmail dot com
Summary: upgrade from alpha2 to beta3 breaks iterator.php
-Status: Open
+Status: Closed
Type: Bug
Package: MDB2
Operating System: Linux 3.0.6-gentoo
Package Version: 2.5.0b3
PHP Version: 5.3.8
-Assigned To:
+Assigned To: danielc
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: danielc
The bug is triggered by passing a result_wrap_class to a query() method.
The problem was in _wrapResult(), which was mistakenly changed in rev
288591 to pass the result resource. A result object is what shoudl be
passed. Fixed in r321264. A type check has also been added to the
iterator constructor to clarify the problem something like this happens
again.


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

[2011-11-10 06:53:42] cgmoller

Description:
------------
Fatal error: Call to a member function seek() on a non-object in
/usr/share/php/MDB2/Iterator.php on line 86


1. My code works on the previous version
PEAR-MDB2-2.5.0_alpha2
PEAR-MDB2_Driver_mssql-1.5.0_alpha2

2. Code fails on the newest version
PEAR-MDB2-2.5.0_beta3
PEAR-MDB2_Driver_mssql-1.5.0_beta3



Test script:
---------------
$mdb2 = MDB2::factory($dsn);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
MDB2::loadFile('Iterator');

$query = "SELECT distinct(Asgn_Group) FROM CSC_Report_Active where
status != 'resolved' order by Asgn_Group ASC";

$result = $mdb2->query($query, true, true, 'MDB2_BufferedIterator');

foreach ($result as $row) { # script breaks here
$tuple = $row['asgn_group'];
# <<code for building an HTML table >>
}
$result->free();
$mdb2->disconnect();


Expected result:
----------------
A table with values as follows:
AES_ASC_EMS
AES_ASC_L2SEC
AES_ASC_MQ
AES_ASC_Security


with echo var_dump($result);

object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
["result":protected]=> object(MDB2_BufferedResult_mssql)#4 (9) {
["db"]=> object(MDB2_Driver_mssql)#1 (37) { ["string_quoting"]=>
array(4) { ["start"]=> string(1) "'" ["end"]=> string(1) "'"
["escape"]=> string(1) "'" ["escape_pattern"]=> bool(false) }
["identifier_quoting"]=> array(3)
...
and much more.

Actual result:
--------------
with echo var_dump($result);

object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
["result":protected]=> resource(9) of type (mssql result)
["row":protected]=> NULL }

Fatal error: Call to a member function seek() on a non-object in
/usr/share/php/MDB2/Iterator.php on line 86

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

Search Discussions

  • Danielc at Dec 20, 2011 at 2:38 am
    Edit report at https://pear.php.net/bugs/bug.php?id=18978&edit=1

    ID: 18978
    Updated by: danielc@analysisandsolutions.com
    Reported By: cameron dot moller at gmail dot com
    Summary: upgrade from alpha2 to beta3 breaks iterator.php
    Status: Closed
    Type: Bug
    Package: MDB2
    Operating System: Linux 3.0.6-gentoo
    Package Version: 2.5.0b3
    PHP Version: 5.3.8
    Assigned To: danielc
    Roadmap Versions:
    New Comment:

    For the record, revision 288591 (mentioned in my prior comment)
    addressed Bug #16508.


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

    [2011-12-20 00:45:49] danielc

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: danielc
    The bug is triggered by passing a result_wrap_class to a query() method.
    The problem was in _wrapResult(), which was mistakenly changed in rev
    288591 to pass the result resource. A result object is what shoudl be
    passed. Fixed in r321264. A type check has also been added to the
    iterator constructor to clarify the problem something like this happens
    again.

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

    [2011-11-10 06:53:42] cgmoller

    Description:
    ------------
    Fatal error: Call to a member function seek() on a non-object in
    /usr/share/php/MDB2/Iterator.php on line 86


    1. My code works on the previous version
    PEAR-MDB2-2.5.0_alpha2
    PEAR-MDB2_Driver_mssql-1.5.0_alpha2

    2. Code fails on the newest version
    PEAR-MDB2-2.5.0_beta3
    PEAR-MDB2_Driver_mssql-1.5.0_beta3



    Test script:
    ---------------
    $mdb2 = MDB2::factory($dsn);
    if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
    }
    $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
    MDB2::loadFile('Iterator');

    $query = "SELECT distinct(Asgn_Group) FROM CSC_Report_Active where
    status != 'resolved' order by Asgn_Group ASC";

    $result = $mdb2->query($query, true, true, 'MDB2_BufferedIterator');

    foreach ($result as $row) { # script breaks here
    $tuple = $row['asgn_group'];
    # <<code for building an HTML table >>
    }
    $result->free();
    $mdb2->disconnect();


    Expected result:
    ----------------
    A table with values as follows:
    AES_ASC_EMS
    AES_ASC_L2SEC
    AES_ASC_MQ
    AES_ASC_Security


    with echo var_dump($result);

    object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
    ["result":protected]=> object(MDB2_BufferedResult_mssql)#4 (9) {
    ["db"]=> object(MDB2_Driver_mssql)#1 (37) { ["string_quoting"]=>
    array(4) { ["start"]=> string(1) "'" ["end"]=> string(1) "'"
    ["escape"]=> string(1) "'" ["escape_pattern"]=> bool(false) }
    ["identifier_quoting"]=> array(3)
    ...
    and much more.

    Actual result:
    --------------
    with echo var_dump($result);

    object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
    ["result":protected]=> resource(9) of type (mssql result)
    ["row":protected]=> NULL }

    Fatal error: Call to a member function seek() on a non-object in
    /usr/share/php/MDB2/Iterator.php on line 86

    ------------------------------------------------------------------------
  • Danielc at Dec 20, 2011 at 3:42 am
    Edit report at https://pear.php.net/bugs/bug.php?id=18978&edit=1

    ID: 18978
    Updated by: danielc@analysisandsolutions.com
    Reported By: cameron dot moller at gmail dot com
    Summary: upgrade from alpha2 to beta3 breaks iterator.php
    Status: Closed
    Type: Bug
    Package: MDB2
    Operating System: Linux 3.0.6-gentoo
    Package Version: 2.5.0b3
    PHP Version: 5.3.8
    Assigned To: danielc
    Roadmap Versions:
    New Comment:

    Note, this is related to bug #19148.


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

    [2011-12-20 03:38:16] danielc

    For the record, revision 288591 (mentioned in my prior comment)
    addressed Bug #16508.

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

    [2011-12-20 00:45:49] danielc

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: danielc
    The bug is triggered by passing a result_wrap_class to a query() method.
    The problem was in _wrapResult(), which was mistakenly changed in rev
    288591 to pass the result resource. A result object is what shoudl be
    passed. Fixed in r321264. A type check has also been added to the
    iterator constructor to clarify the problem something like this happens
    again.

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

    [2011-11-10 06:53:42] cgmoller

    Description:
    ------------
    Fatal error: Call to a member function seek() on a non-object in
    /usr/share/php/MDB2/Iterator.php on line 86


    1. My code works on the previous version
    PEAR-MDB2-2.5.0_alpha2
    PEAR-MDB2_Driver_mssql-1.5.0_alpha2

    2. Code fails on the newest version
    PEAR-MDB2-2.5.0_beta3
    PEAR-MDB2_Driver_mssql-1.5.0_beta3



    Test script:
    ---------------
    $mdb2 = MDB2::factory($dsn);
    if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
    }
    $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
    MDB2::loadFile('Iterator');

    $query = "SELECT distinct(Asgn_Group) FROM CSC_Report_Active where
    status != 'resolved' order by Asgn_Group ASC";

    $result = $mdb2->query($query, true, true, 'MDB2_BufferedIterator');

    foreach ($result as $row) { # script breaks here
    $tuple = $row['asgn_group'];
    # <<code for building an HTML table >>
    }
    $result->free();
    $mdb2->disconnect();


    Expected result:
    ----------------
    A table with values as follows:
    AES_ASC_EMS
    AES_ASC_L2SEC
    AES_ASC_MQ
    AES_ASC_Security


    with echo var_dump($result);

    object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
    ["result":protected]=> object(MDB2_BufferedResult_mssql)#4 (9) {
    ["db"]=> object(MDB2_Driver_mssql)#1 (37) { ["string_quoting"]=>
    array(4) { ["start"]=> string(1) "'" ["end"]=> string(1) "'"
    ["escape"]=> string(1) "'" ["escape_pattern"]=> bool(false) }
    ["identifier_quoting"]=> array(3)
    ...
    and much more.

    Actual result:
    --------------
    with echo var_dump($result);

    object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2)
    ["result":protected]=> resource(9) of type (mssql result)
    ["row":protected]=> NULL }

    Fatal error: Call to a member function seek() on a non-object in
    /usr/share/php/MDB2/Iterator.php on line 86

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 19, '11 at 11:45p
activeDec 20, '11 at 3:42a
posts3
users1
websitepear.php.net

1 user in discussion

Danielc: 3 posts

People

Translate

site design / logo © 2021 Grokbase