From:             ernesto_vargas at yahoo dot com
Operating system: Fedora 12
PHP version:      5.3.1
PHP Bug Type:     MySQL related
Bug description:  PROCEDURE db.myproc can't return a result set in the given 
context

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 bug report at http://bugs.php.net/?id=50416&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50416&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50416&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50416&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50416&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50416&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50416&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50416&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50416&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50416&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50416&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50416&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50416&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50416&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50416&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50416&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50416&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50416&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50416&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50416&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50416&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50416&r=mysqlcfg

Reply via email to