summaryrefslogtreecommitdiffstats
path: root/php-bug78297.patch
blob: facf6395a6998e97092219fe3b90e9c46bfc8e77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 8a19fe29de77d7477d59db472dd6aadabd5ac249 Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Tue, 16 Jul 2019 11:08:27 +0200
Subject: [PATCH] Fixed bug #78297

---
 NEWS                            |  2 ++
 sapi/phpdbg/phpdbg_list.c       |  1 +
 sapi/phpdbg/tests/bug78297.phpt | 16 ++++++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 sapi/phpdbg/tests/bug78297.phpt

diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index aab641c..a9b0f4b 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -248,6 +248,7 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) {
 		} else {
 			zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file->filename);
 		}
+		return NULL;
 	}
 
 	data.buf = estrndup(bufptr, len);
diff --git a/sapi/phpdbg/tests/bug78297.phpt b/sapi/phpdbg/tests/bug78297.phpt
new file mode 100644
index 0000000..47b13ad
--- /dev/null
+++ b/sapi/phpdbg/tests/bug78297.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #78297: Include unexistent file memory leak
+--PHPDBG--
+r
+q
+--FILE--
+<?php
+include "does_not_exist.php";
+--EXPECTF--
+[Successful compilation of %s]
+prompt> 
+Warning: include(%s): failed to open stream: No such file or directory in %s on line %d
+
+Warning: include(): Failed opening 'does_not_exist.php' for inclusion (include_path=%s) in %s on line %d
+[Script ended normally]
+prompt>
-- 
2.1.4