Skip to content

Commit a984f4a

Browse files
committed
Merge branch 'master' into refactor_bcmath_do_add
2 parents aa80c0d + f88fc9c commit a984f4a

File tree

4 files changed

+79
-5
lines changed

4 files changed

+79
-5
lines changed

ext/readline/readline_cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ static int cli_is_valid_code(char *code, size_t len, zend_string **prompt) /* {{
343343
case ' ':
344344
case '\t':
345345
case '\'':
346+
case '"':
346347
break;
347348
case '\r':
348349
case '\n':

ext/xmlreader/php_xmlreader.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,17 @@ zval *xmlreader_write_property(zend_object *object, zend_string *name, zval *val
162162
/* {{{ */
163163
static zend_function *xmlreader_get_method(zend_object **obj, zend_string *name, const zval *key)
164164
{
165-
if (zend_string_equals_literal_ci(name, "open")) {
166-
return (zend_function*)&xmlreader_open_fn;
167-
} else if (zend_string_equals_literal_ci(name, "xml")) {
168-
return (zend_function*)&xmlreader_xml_fn;
165+
zend_function *method = zend_std_get_method(obj, name, key);
166+
if (method && (method->common.fn_flags & ZEND_ACC_STATIC) && method->common.type == ZEND_INTERNAL_FUNCTION) {
167+
/* There are only two static internal methods and they both have overrides. */
168+
if (ZSTR_LEN(name) == sizeof("xml") - 1) {
169+
return (zend_function *) &xmlreader_xml_fn;
170+
} else {
171+
ZEND_ASSERT(ZSTR_LEN(name) == sizeof("open") - 1);
172+
return (zend_function *) &xmlreader_open_fn;
173+
}
169174
}
170-
return zend_std_get_method(obj, name, key);
175+
return method;
171176
}
172177
/* }}} */
173178

ext/xmlreader/tests/gh14183.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
GH-14183 (XMLReader::open() can't be overridden)
3+
--EXTENSIONS--
4+
xmlreader
5+
--FILE--
6+
<?php
7+
class MyXMLReader extends XMLReader
8+
{
9+
public static function open(string $uri, ?string $encoding = null, int $flags = 0): bool|\XMLReader
10+
{
11+
echo 'overridden', PHP_EOL;
12+
return true;
13+
}
14+
}
15+
16+
var_dump(MyXMLReader::open('asdf'));
17+
$o = new MyXMLReader;
18+
var_dump($o->open('asdf'));
19+
?>
20+
--EXPECT--
21+
overridden
22+
bool(true)
23+
overridden
24+
bool(true)

sapi/cli/tests/gh14189.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
GH-14189 (PHP Interactive shell input state incorrectly handles quoted heredoc literals.)
3+
--EXTENSIONS--
4+
readline
5+
--SKIPIF--
6+
<?php
7+
include "skipif.inc";
8+
if (readline_info('done') === NULL) {
9+
die ("skip need readline support");
10+
}
11+
?>
12+
--FILE--
13+
<?php
14+
$php = getenv('TEST_PHP_EXECUTABLE');
15+
16+
// disallow console escape sequences that may break the output
17+
putenv('TERM=VT100');
18+
19+
$code = <<<EOT
20+
\$test = <<<"EOF"
21+
foo
22+
bar
23+
baz
24+
EOF;
25+
echo \$test;
26+
exit
27+
EOT;
28+
29+
$code = escapeshellarg($code);
30+
echo `echo $code | "$php" -a`, "\n";
31+
?>
32+
--EXPECT--
33+
Interactive shell
34+
35+
php > $test = <<<"EOF"
36+
<<< > foo
37+
<<< > bar
38+
<<< > baz
39+
<<< > EOF;
40+
php > echo $test;
41+
foo
42+
bar
43+
baz
44+
php > exit

0 commit comments

Comments
 (0)