Skip to content

Commit 84a90f6

Browse files
Test
1 parent 41fe8d8 commit 84a90f6

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
@@ -2199,6 +2199,11 @@ public function testBug3506(): void
21992199
$this->analyse([__DIR__ . '/data/bug-3506.php'], []);
22002200
}
22012201

2202+
public function testBug9970(): void
2203+
{
2204+
$this->analyse([__DIR__ . '/data/bug-9970.php'], []);
2205+
}
2206+
22022207
#[RequiresPhp('>= 8.0')]
22032208
public function testBug12317(): void
22042209
{
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)