xref: /PHP-5.4/ext/sybase_ct/tests/bug28354.phpt (revision 6218d2d9)
1--TEST--
2Sybase-CT bug #28354 (sybase_free_result crash)
3--SKIPIF--
4<?php require('skipif.inc'); ?>
5--FILE--
6<?php
7/* This file is part of PHP test framework for ext/sybase_ct
8 *
9 * $Id$
10 */
11
12  require('test.inc');
13
14  $db= sybase_connect_ex();
15  sybase_set_message_handler('sybase_msg_handler');
16  error_reporting(error_reporting() & !E_NOTICE);       // Suppress notices
17
18  // Check if stored procedure already exists
19  $sp_name= 'phpt_bug28354';
20  var_dump(sybase_select_db(TEMPDB, $db));
21  if (!sybase_select_single($db, 'select object_id("'.$sp_name.'")')) {
22    echo "Stored procedure {$sp_name} not found, creating\n";
23    var_dump(sybase_query('
24      create proc '.$sp_name.' as begin
25        select @@version
26      end
27    '));
28  } else {
29    echo "Stored procedure {$sp_name} found, using\n";
30    var_dump(TRUE);
31  }
32
33  $r= sybase_query('exec '.$sp_name, $db);
34  $i= 0;
35  while ($row= sybase_fetch_row($r)) {
36    var_dump($i++, $row[0]);
37  }
38  sybase_free_result($r);
39  sybase_close($db);
40?>
41--EXPECTF--
42bool(true)
43Stored procedure %s
44bool(true)
45int(0)
46string(%d) "%s"
47