From: matteo at beccati dot com
Operating system: Any
PHP version: 5.3.0beta1
PHP Bug Type: PDO related
Bug description: PDO::PARAM_LOB columns need to be bound before execute() on
PgSQL
Description:
------------
I was trying to investigate a test failure in the pdo_pgsql extension,
namely the large_objects.phpt.
The failure is caused by the fact that the LOB parameter is bound after
calling execute, which seems to be unsupported. Moving the call to
bindColumn() before execute() fixes the test.
I've also tried to fix it, but no matter how hard I tried I couldn't find
a suitable solution that also kept backwards compatibility (i.e. returning
the large object OID as int if the parameter is not explicitly bound as
PDO::PARAM_LOB).
Therefore I think that the best solution would be to document such
behaviour and fix the test accordingly.
Note: it doesn't look like a duplicate of #40913, as mysql and sqlite do
not seem to have custom code to retrieve data as a stream.
Reproduce code:
---------------
$stmt = $db->prepare("SELECT * from test");
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
$stmt->execute();
$stmt->fetch(PDO::FETCH_ASSOC);
var_dump(is_resource($lob));
$stmt = $db->prepare("SELECT * from test");
$stmt->execute();
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_ASSOC);
var_dump(is_resource($lob));
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
bool(true)
bool(false)
--
Edit bug report at http://bugs.php.net/?id=47311&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47311&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47311&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47311&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47311&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47311&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47311&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47311&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47311&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47311&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47311&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47311&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47311&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47311&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47311&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47311&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47311&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47311&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47311&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47311&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47311&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47311&r=mysqlcfg