Skip to content

Commit 9ca52eb

Browse files
committed
Fix tests
1 parent 93715c8 commit 9ca52eb

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

ext/mysqli/mysqli_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ PHP_FUNCTION(mysqli_options)
17171717
RETURN_THROWS();
17181718
}
17191719
ret = mysql_options(mysql->mysql, mysql_option, (char *) &mysql_value_long);
1720-
} else if (expected_type == IS_NULL) {
1720+
} else {
17211721
ret = 1;
17221722
}
17231723

ext/mysqli/tests/mysqli_options.phpt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ require_once('skipifconnectfailure.inc');
3838
var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
3939
var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
4040
var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
41-
var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
41+
try {
42+
var_dump("MYSQLI_INIT_COMMAND");
43+
mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1'));
44+
} catch (TypeError $exception) {
45+
echo $exception->getMessage() . "\n";
46+
}
4247

4348
if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
4449
printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
@@ -106,10 +111,8 @@ bool(true)
106111
bool(true)
107112
%s(23) "MYSQLI_OPT_LOCAL_INFILE"
108113
bool(true)
109-
110-
Warning: Array to string conversion in %s on line %d
111114
%s(19) "MYSQLI_INIT_COMMAND"
112-
bool(true)
115+
mysqli_options(): Argument #3 ($value) must be of type string|int, array given
113116
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
114117
bool(true)
115118
%s(24) "MYSQLI_READ_DEFAULT_FILE"

ext/odbc/php_odbc.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,22 +1752,15 @@ PHP_FUNCTION(odbc_result)
17521752

17531753
ZEND_PARSE_PARAMETERS_START(2, 2)
17541754
Z_PARAM_RESOURCE(pv_res)
1755-
Z_PARAM_STR_OR_LONG(pv_field_str, pv_field_ind)
1755+
Z_PARAM_STR_OR_LONG(pv_field_str, pv_field_long)
17561756
ZEND_PARSE_PARAMETERS_END();
17571757

17581758
if (pv_field_str) {
17591759
field = ZSTR_VAL(pv_field_str);
17601760
field_ind = -1;
17611761
} else {
17621762
field = NULL;
1763-
field_ind = pv_field_long - 1;
1764-
}
1765-
1766-
if (Z_TYPE_P(pv_field) == IS_STRING) {
1767-
field = Z_STRVAL_P(pv_field);
1768-
} else {
1769-
convert_to_long_ex(pv_field);
1770-
field_ind = Z_LVAL_P(pv_field) - 1;
1763+
field_ind = (int) pv_field_long - 1;
17711764
}
17721765

17731766
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {

ext/xml/tests/bug72714.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Bug #72714 (_xml_startElementHandler() segmentation fault)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded('xml')) die('skip xml extension not available');
6+
if (PHP_INT_SIZE != 8) die('skip 64-bit only');
67
?>
78
--FILE--
89
<?php
@@ -28,6 +29,6 @@ parse(3015809298423721);
2829
parse(20);
2930
?>
3031
--EXPECTF--
31-
Notice: xml_parser_set_option(): tagstart ignored, because it is out of range in %s%ebug72714.php on line %d
32+
Warning: xml_parser_set_option(): tagstart ignored, because it is out of range in %s on line %d
3233
string(9) "NS1:TOTAL"
3334
string(0) ""

ext/xml/tests/xml_parser_set_option_variation3.phpt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Test xml_parser_set_option() function : usage variations
55
if (!extension_loaded("xml")) {
66
print "skip - XML extension not loaded";
77
}
8+
if (PHP_INT_SIZE != 8) {
9+
die('skip 64-bit only');
10+
}
811
?>
912
--FILE--
1013
<?php
@@ -153,19 +156,19 @@ Arg value
153156
bool(true)
154157

155158
Arg value
156-
xml_parser_set_option(): Argument #3 ($value) must be of type string for the chosen option
159+
xml_parser_set_option(): Argument #3 ($value) must be of type int for the chosen option
157160

158161
Arg value
159-
xml_parser_set_option(): Argument #3 ($value) must be of type string for the chosen option
162+
xml_parser_set_option(): Argument #3 ($value) must be of type int for the chosen option
160163

161164
Arg value string
162-
xml_parser_set_option(): Argument #3 ($value) must be of type string for the chosen option
165+
xml_parser_set_option(): Argument #3 ($value) must be of type int for the chosen option
163166

164167
Arg value string
165-
xml_parser_set_option(): Argument #3 ($value) must be of type string for the chosen option
168+
xml_parser_set_option(): Argument #3 ($value) must be of type int for the chosen option
166169

167170
Arg value Some Ascii Data
168-
xml_parser_set_option(): Argument #3 ($value) must be of type string for the chosen option
171+
xml_parser_set_option(): Argument #3 ($value) must be of type int for the chosen option
169172

170173
Arg value Resource id %s
171174
xml_parser_set_option(): Argument #3 ($value) must be of type string|int, resource given

ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ Check xsltprocessor::setparameter error handling with no-string
44
Memleak: http://bugs.php.net/bug.php?id=48221
55
--SKIPIF--
66
<?php
7-
if (!extension_loaded('xsl')) {
8-
die("skip\n");
9-
}
7+
if (!extension_loaded('xsl')) {
8+
die("skip\n");
9+
}
1010
?>
1111
--FILE--
1212
<?php
1313
include __DIR__ .'/prepare.inc';
1414
$proc->importStylesheet($xsl);
15-
var_dump($proc->setParameter('', array(4, 'abc')));
15+
try {
16+
$proc->setParameter('', array(4, 'abc'));
17+
} catch (TypeError $exception) {
18+
echo $exception->getMessage() . "\n";
19+
}
1620
$proc->transformToXml($dom);
1721
?>
18-
--EXPECTF--
19-
Warning: XSLTProcessor::setParameter(): Invalid parameter array in %s on line %d
20-
bool(false)
22+
--EXPECT--
23+
XSLTProcessor::setParameter(): Argument #2 ($name) must contain only string keys
2124
--CREDITS--
2225
Christian Weiske, cweiske@php.net
2326
PHP Testfest Berlin 2009-05-09

0 commit comments

Comments
 (0)