mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix #79514: Memory leaks while including unexistent file
We have to destroy (un-opened) ZEND_HANDLE_FILENAMEs.
This commit is contained in:
parent
3676418568
commit
3151676f52
3 changed files with 17 additions and 0 deletions
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ PHP NEWS
|
|||
- Core:
|
||||
. Fixed bug #78434 (Generator yields no items after valid() call). (Nikita)
|
||||
. Fixed bug #79477 (casting object into array creates references). (Nikita)
|
||||
. Fixed bug #79514 (Memory leaks while including unexistent file). (cmb,
|
||||
Nikita)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #78221 (DOMNode::normalize() doesn't remove empty text nodes).
|
||||
|
|
13
Zend/tests/bug79514.phpt
Normal file
13
Zend/tests/bug79514.phpt
Normal file
|
@ -0,0 +1,13 @@
|
|||
--TEST--
|
||||
Bug #79514 (Memory leaks while including unexistent file)
|
||||
--FILE--
|
||||
<?php
|
||||
$mem1 = memory_get_usage(true);
|
||||
for ($i = 0; $i < 100000; $i++) {
|
||||
@include __DIR__ . '/bug79514.doesnotexist';
|
||||
}
|
||||
$mem2 = memory_get_usage(true);
|
||||
var_dump($mem2 - $mem1 < 100000);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
|
@ -238,6 +238,8 @@ ZEND_API int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *
|
|||
return 0;
|
||||
}
|
||||
switch (fh1->type) {
|
||||
case ZEND_HANDLE_FILENAME:
|
||||
return strcmp(fh1->filename, fh2->filename) == 0;
|
||||
case ZEND_HANDLE_FP:
|
||||
return fh1->handle.fp == fh2->handle.fp;
|
||||
case ZEND_HANDLE_STREAM:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue