1--TEST--
2Sybase-CT server message handler
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
16  echo 'Nonexistent:     '; sybase_set_messagehandler_ex('function_does_not_exist');
17  echo 'Static method:   '; sybase_set_messagehandler_ex(array('sybase', 'static_handler'));
18  echo 'Instance method: '; sybase_set_messagehandler_ex(array(new sybase(), 'handler'));
19  echo 'Lambda function: '; sybase_set_messagehandler_ex(create_function('', 'return FALSE;'));
20  echo 'Unset:           '; sybase_set_messagehandler_ex(NULL);
21  echo 'Incorrect type:  '; sybase_set_messagehandler_ex(1);
22  echo 'Function:        '; sybase_set_messagehandler_ex('sybase_msg_handler');
23
24  var_dump(sybase_select_ex($db, 'select getdate(NULL)'));
25  sybase_close($db);
26?>
27--EXPECTF--
28Nonexistent:
29Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, function 'function_does_not_exist' not found or invalid function name in %stest.inc on line %d
30NULL
31Static method:   bool(true)
32Instance method: bool(true)
33Lambda function: bool(true)
34Unset:           bool(true)
35Incorrect type:
36Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, no array or string given in %stest.inc on line %d
37NULL
38Function:        bool(true)
39>>> Query: select getdate(NULL)
40*** Caught Sybase Server Message #%d [Severity %d, state %d] at line %d
41    %s
42<<< Return: boolean
43bool(false)
44