Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16796

Re: Closing a statement causes a "malformed object" error on the result - by design ?

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Closing a statement causes a "malformed object" error on the result - by design ?
Date 2016-06-27 01:33 +0200
Organization solani.org
Message-ID <nkponn$fii$1@solani.org> (permalink)
References <576fede9$0$5918$e4fe514c@news.xs4all.nl>

Show all headers | View raw


On 26.06.2016 at 17:02, R.Wieser wrote:

> To access some data in  a SQLite3 database I tried to execute the below:

I presume you mean something like:

    <?php

    $conn = new SQLite3(':memory:');
    $conn->exec('CREATE TABLE test (id int)');
    $conn->exec('INSERT INTO test VALUES (1)');
    $statement= $conn->prepare('SELECT * FROM test');
    $result = $statement->execute();
    $statement->close();
    $row = $result->fetchArray();

> The problem is that that last line throws an "malformed object" error*.
> However, when I move the "statement->close();" line to the bottom all goes
> well.
> 
> *the error itself feels incorrect, as the problem is not the object
> ($results) itself, but just that it can't find its parent ($statement)
> anymore ...

I get:

| Warning: SQLite3Result::fetchArray(): The SQLite3Result object has
| not been correctly initialised in ... on line 9

From looking at the message and the actual behavior I assume that
SQLite3Stmt::close() invalidates the SQLite3Result object.  This is,
however, something I'd like to see documented in the php.net manual.

> Question: is the closing a "parent" object causing the "child" to
> malfunction an expected/described something within PHP, or should I consider
> it a bug.

I don't think it's a bug, but the behavior should be explicitly
mentioned in the manual, so I suggest to file a doc bug against
<https://bugs.php.net/>.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Closing a statement causes a "malformed object" error on the result - by design ? "R.Wieser" <address@not.available> - 2016-06-26 17:02 +0200
  Re: Closing a statement causes a "malformed object" error on the result - by design ? Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-26 12:23 -0400
    Re: Closing a statement causes a "malformed object" error on theresult - by design ? "R.Wieser" <address@not.available> - 2016-06-26 22:07 +0200
      Re: Closing a statement causes a "malformed object" error on theresult - by design ? Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-26 16:45 -0400
        Re: Closing a statement causes a "malformed object" error ontheresult - by design ? "R.Wieser" <address@not.available> - 2016-06-27 12:26 +0200
          Re: Closing a statement causes a "malformed object" error ontheresult - by design ? Jerry Stuckle <jstucklex@attglobal.net> - 2016-06-27 10:11 -0400
      Re: Closing a statement causes a "malformed object" error on theresult - by design ? "Peter H. Coffin" <hellsop@ninehells.com> - 2016-06-26 15:55 -0500
        Re: Closing a statement causes a "malformed object" error ontheresult - by design ? "R.Wieser" <address@not.available> - 2016-06-27 11:11 +0200
  Re: Closing a statement causes a "malformed object" error on the result - by design ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-27 01:33 +0200
    Re: Closing a statement causes a "malformed object" error on theresult - by design ? "R.Wieser" <address@not.available> - 2016-06-27 11:44 +0200
      Re: Closing a statement causes a "malformed object" error on theresult - by design ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-27 13:10 +0200
        Re: Closing a statement causes a "malformed object" error ontheresult - by design ? "R.Wieser" <address@not.available> - 2016-06-27 15:02 +0200
          Re: Closing a statement causes a "malformed object" error ontheresult - by design ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-27 15:33 +0200
            Re: Closing a statement causes a "malformed object" error on the result - by design ? "R.Wieser" <address@not.available> - 2016-06-27 16:45 +0200
              Re: Closing a statement causes a "malformed object" error on the result - by design ? "R.Wieser" <address@not.available> - 2016-06-28 12:45 +0200
                Re: Closing a statement causes a "malformed object" error on the result - by design ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-28 15:25 +0200
                Re: Closing a statement causes a "malformed object" error on theresult - by design ? "R.Wieser" <address@not.available> - 2016-06-28 18:41 +0200
                Re: Closing a statement causes a "malformed object" error on theresult - by design ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-28 19:29 +0200

csiph-web