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 ?

Path csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
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 Mon, 27 Jun 2016 01:33:21 +0200
Organization solani.org
Lines 43
Message-ID <nkponn$fii$1@solani.org> (permalink)
References <576fede9$0$5918$e4fe514c@news.xs4all.nl>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1466983991 15954 eJwNxMEBwCAIA8CVEjCA46At+4/Q3uPkwbi5QrE0GhBq5g1jiHhw0rXSdN9pzdzDlazeLvPsfhN2coIJlrbT2DbV/4iosw/MINR0Enw+MdUcPA== (26 Jun 2016 23:33:11 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sun, 26 Jun 2016 23:33:11 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
X-User-ID eJwFwQkBgAAIA8BKIDAwjjzrH8G7MCgmHQEPBpnV69yz75SoekXHT86fbtBRzBNyhFdb9gM1qBIJ
In-Reply-To <576fede9$0$5918$e4fe514c@news.xs4all.nl>
Cancel-Lock sha1:pEu0PFt+UiDElqkf05feLhc412c=
X-NNTP-Posting-Host eJwNzAkBACEIBMBKyifEccHtH+FuAoxr7Ohj4WFOJ+IduY/oul0br60DUs7JVZ3EqczK5lCwpq6sHj2Eks8R2Wv+7j8LO0d12kwfUCZh8gEKnx/K
Xref csiph.com comp.lang.php:16796

Show key headers only | 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