ID:               36788
 User updated by:  bubblenut at gmail dot com
 Reported By:      bubblenut at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         PDO related
 Operating System: Linux 2.6.12 (Kubuntu)
 PHP Version:      5.1.2
 New Comment:

I get the following error when doing the make install

SECURITY ERROR: PHP_Archive::mapPhar can only be called from within the
phar that initiates itInstalling PDO headers:         
/usr/local/php/include/php/ext/pdo/


Also earlier in the make install I get the following libtool warning
libtool: install: warning: remember to run `libtool --finish
/usr/local/src/php5.1-200603200930/libs'


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

[2006-03-20 11:09:14] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip



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

[2006-03-20 00:55:22] bubblenut at gmail dot com

Ahh, sorry, little typo, OK it looks like it's just in the parameter
insertion then (do I need to start a new bug report?)

Revised Code
------------
<?php
//phpinfo();

$db   = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT id FROM recipe WHERE id=?");
$stmt->bindValue(1, 1);
$stmt->execute();
$res = $stmt->fetchAll();
var_dump($res);

$stmt = $db->prepare("SELECT id FROM recipe WHERE id=1");
$stmt->execute();
$res  = $stmt->fetchAll();
var_dump($res);

foreach($db->query("SELECT id FROM recipe WHERE id=1") as $res) {
    var_dump($res);
}

Expected Result
---------------
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

Actual Result
-------------
array(0) {
}
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

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

[2006-03-20 00:40:03] [EMAIL PROTECTED]

It still doesn't work without execute() after prepare().
And after adding this execute() call, it works _just fine_.

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

[2006-03-20 00:29:10] bubblenut at gmail dot com

OK, so change the fetches for fetchAlls an alter the expected and
actual results acordingly (yes I have tested with those methods). The
bug still stands. Prepared statements are not working for this install.

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

[2006-03-19 22:47:39] [EMAIL PROTECTED]

This is what I get with your code (and this is expected):
-------------------
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while
other unbuffered queries are active.  Consider using
PDOStatement::fetchAll().  Alternatively, if your code is only ever
going to run against mysql, you may enable query buffering by setting
the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /tmp/1.php:11
Stack trace:
#0 /tmp/1.php(11): PDO->prepare('SELECT id FROM ...')
#1 {main}
  thrown in /tmp/1.php on line 11
-------------------

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/36788

-- 
Edit this bug report at http://bugs.php.net/?id=36788&edit=1

Reply via email to