#50416 [Opn->Asn]: PROCEDURE db.myproc can't return a result set in the given context
| From: | jani@php.net | Date: | Thu, 17 Dec 2009 08:23:52 +0000 |
| Subject: | #50416 [Opn->Asn]: PROCEDURE db.myproc can't return a result set in the given context | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-145840@lists.php.net to get a copy of this message | ||
ID: 50416
Updated by: jani@php.net
Reported By: ernesto_vargas at yahoo dot com
-Status: Open
+Status: Assigned
Bug Type: MySQL related
-Operating System: Fedora 12
+Operating System: *
-PHP Version: 5.3.1
+PHP Version: 5.3, 6
-Assigned To:
+Assigned To: mysql
New Comment:
Works with latest PHP 5.2, fails with 5.3+.
Previous Comments:
------------------------------------------------------------------------
[2009-12-08 22:44:04] ermesto_vargas at yahoo dot com
./configure --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu
--program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share
--includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec
--localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man
--infodir=/usr/share/info --cache-file=../config.cache
--with-libdir=lib64 --with-config-file-path=/etc
--with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic
--disable-rpath --without-pear --with-bz2 --with-exec-dir=/usr/bin
--with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr
--enable-gd-native-ttf --with-t1lib=/usr --without-gdbm --with-gettext
--with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl
--with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-exif
--enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem
--enable-sysvshm --enable-sysvmsg --with-kerberos --enable-ucd-snmp-hack
--enable-shmop --enable-calendar --without-mime-magic --without-sqlite
--with-libxml-dir=/usr --enable-xml --with-system-tzdata --with-mysql
--without-gd --disable-dom --disable-dba --without-unixODBC
--disable-pdo --disable-xmlreader --disable-xmlwriter --without-sqlite3
--disable-phar --disable-fileinfo --disable-json --without-pspell
--disable-wddx --without-curl --disable-posix --disable-sysvmsg
--disable-sysvshm --disable-sysvsem
Same results here is the result:
---------------------------------------------------------------------
Current PHP version: 5.3.2-dev
Current MYSQL version: 1.0
Warning: mysql_query(): PROCEDURE test.myproc can't return a result set
in the given context in /home/html/sp_test.php on line 14
Invalid query: PROCEDURE test.myproc can't return a result set in the
given context
Whole query: CALL myproc();
------------------------------------------------------------------------
[2009-12-08 21:57:29] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
And if that does not work, please provide your configure line.
------------------------------------------------------------------------
[2009-12-08 20:28:54] ernesto_vargas at yahoo dot com
Description:
------------
Any call to a mysql stored procedure produces the following error:
"PROCEDURE database.store_proc_name can't return a result set in the
given context"
When calling the stored procedure from mysql cli client do return the
results correctly.
Tested against MySql 5.0 and 5.1.
Work on php-5.2.9 but not on php-5.3.0 or php-5.3.1
Reproduce code:
---------------
DELIMITER $$
CREATE PROCEDURE
myproc()
BEGIN
SELECT 'it works!';
END$$
<?php
$link = mysql_connect('127.0.0.1','root','',false,65536);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('test', $link);
if (!$db_selected) {
die ('Can\'t use maxdb : ' . mysql_error());
}
$query = 'CALL myproc();';
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$row = mysql_fetch_row($result);
var_dump($row);
mysql_free_result($result);
mysql_close($link);
Expected result:
----------------
array(1) {
["it works!"]=>
string(9) "it works!"
}
Actual result:
--------------
Warning: mysql_query(): PROCEDURE test.myproc can't return a result set
in the given context in /home/html/sp_test.php on line 11
Invalid query: PROCEDURE test.myproc can't return a result set in the
given context
Whole query: CALL myproc();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50416&edit=1