xref: /PHP-8.4/ext/libxml/tests/bug63389.phpt (revision 90e0ce7f)
1--TEST--
2Bug #63389 (Missing context check on libxml_set_streams_context() causes memleak)
3--EXTENSIONS--
4libxml
5--FILE--
6<?php
7try {
8    libxml_set_streams_context("a");
9} catch (TypeError $e) {
10    echo $e->getMessage(), "\n";
11}
12$fp = fopen("php://input", "r");
13try {
14    libxml_set_streams_context($fp);
15} catch (TypeError $e) {
16    echo $e->getMessage(), "\n";
17}
18echo "okey";
19?>
20--EXPECT--
21libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given
22libxml_set_streams_context(): supplied resource is not a valid Stream-Context resource
23okey
24