Skip to content

Commit 22f1ea8

Browse files
Test
1 parent d1ff6aa commit 22f1ea8

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,11 @@ public function testBug5760(): void
22952295
]);
22962296
}
22972297

2298+
public function testBug9970(): void
2299+
{
2300+
$this->analyse([__DIR__ . '/data/bug-9970.php'], []);
2301+
}
2302+
22982303
#[RequiresPhp('>= 8.0')]
22992304
public function testBug12317(): void
23002305
{
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Bug9970;
4+
5+
class XML_Parser
6+
{
7+
public $dummy = "a";
8+
9+
function parse($data)
10+
{
11+
$parser = xml_parser_create();
12+
13+
xml_set_object($parser, $this);
14+
15+
xml_set_element_handler($parser, 'startHandler', 'endHandler');
16+
17+
xml_parse($parser, $data, true);
18+
19+
xml_parser_free($parser);
20+
}
21+
22+
function startHandler($XmlParser, $tag, $attr)
23+
{
24+
$this->dummy = "b";
25+
throw new \Exception("ex");
26+
}
27+
28+
function endHandler($XmlParser, $tag)
29+
{
30+
}
31+
}
32+
33+
$p1 = new Xml_Parser();
34+
try {
35+
$p1->parse('<tag1><tag2></tag2></tag1>');
36+
echo "Exception swallowed\n";
37+
} catch (\Exception $e) {
38+
echo "OK\n";
39+
}

0 commit comments

Comments
 (0)