Skip to content
Browse files

Freeing already freed memory on importing of a non-existent file was …

…eliminated, a new test was added
  • Loading branch information...
1 parent a978619 commit 16ee30a07f5df3b6fb300d4cda1b4e00ce243484 @zenovich committed Sep 20, 2012
Showing with 21 additions and 7 deletions.
  1. +3 −1 package.xml
  2. +0 −6 runkit_import.c
  3. +18 −0 tests/runkit_import_non_existent_file.phpt
View
4 package.xml
@@ -54,7 +54,8 @@ Execute code in restricted environment (sandboxing).
* Properties adding, removing and importing were corrected for right inheritance
* Converting of input parameters (class names & function names) to lowecase was eliminated
* runkit_method_redefine function now sets the 'prototype' field for the method
- and its descendants (Thanks to Anthony Dovgal).
+ and its descendants (Thanks to Anthony Dovgal)
+ * Freeing already freed memory on importing of a non-existent file was eliminated
* Test for correctness of runkit.superglobals feature was added
* Tests for correctness of inheritance of properties were added
* Tests for correctness of adding static properties were added
@@ -180,6 +181,7 @@ Execute code in restricted environment (sandboxing).
<file name="runkit_import_class_property.phpt" role="test" />
<file name="runkit_import_class_property4.inc" role="test" />
<file name="runkit_import_class_property4.phpt" role="test" />
+ <file name="runkit_import_non_existent_file.phpt" role="test" />
<file name="runkit_import_static_properties_override.inc" role="test" />
<file name="runkit_import_static_properties_override.phpt" role="test" />
<file name="runkit_import_with_syntax_error.inc" role="test" />
View
6 runkit_import.c
@@ -592,12 +592,6 @@ void php_runkit_error_cb(int type, const char *error_filename, const uint error_
CG(class_table) = current_class_table;
EG(class_table) = current_eg_class_table;
CG(function_table) = current_function_table;
- zend_hash_destroy(tmp_class_table);
- efree(tmp_class_table);
- zend_hash_destroy(tmp_eg_class_table);
- efree(tmp_eg_class_table);
- zend_hash_destroy(tmp_function_table);
- efree(tmp_function_table);
php_runkit_old_error_cb(type, error_filename, error_lineno, format, args);
}
View
18 tests/runkit_import_non_existent_file.phpt
@@ -0,0 +1,18 @@
+--TEST--
+runkit_import() Importing non-existent file
+--SKIPIF--
+<?php if(!extension_loaded("runkit") || !RUNKIT_FEATURE_MANIPULATION) print "skip";
+ if(array_shift(explode(".", PHP_VERSION)) < 5) print "skip";
+?>
+--FILE--
+<?php
+runkit_import('non-existent_file.unknown');
+echo "After error";
+?>
+--EXPECTF--
+Warning: runkit_import(non-existent_file.unknown): failed to open stream: No such file or directory in %s on line %d
+
+Warning: runkit_import(): Failed opening 'non-existent_file.unknown' for inclusion %s on line %d
+
+Warning: runkit_import(): Import Failure in %s on line %d
+After error

0 comments on commit 16ee30a

Please sign in to comment.
Something went wrong with that request. Please try again.