Skip to content

Commit

Permalink
Fix memory leak / Add version info for phpinfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
hnw committed Nov 21, 2012
1 parent a867004 commit 5604697
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions php_timecop.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#ifndef PHP_TIMECOP_H
#define PHP_TIMECOP_H

#define PHP_TIMECOP_VERSION "1.0.0"

extern zend_module_entry timecop_module_entry;
#define phpext_timecop_ptr &timecop_module_entry

Expand Down
11 changes: 4 additions & 7 deletions timecop.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static zend_function_entry timecop_datetime_class_functions[] = {

static void timecop_globals_ctor(zend_timecop_globals *globals TSRMLS_DC);

static int init_timecop_datetime(TSRMLS_D);
static int register_timecop_classes(TSRMLS_D);
static int timecop_func_override(TSRMLS_D);
static int timecop_class_override(TSRMLS_D);
static int timecop_func_override_clear(TSRMLS_D);
Expand Down Expand Up @@ -259,6 +259,7 @@ PHP_MINIT_FUNCTION(timecop)
{
ZEND_INIT_MODULE_GLOBALS(timecop, timecop_globals_ctor, NULL);
REGISTER_INI_ENTRIES();
register_timecop_classes(TSRMLS_C);
return SUCCESS;
}
/* }}} */
Expand All @@ -278,18 +279,13 @@ PHP_RINIT_FUNCTION(timecop)
int ret;
zend_class_entry *parent_ce;

init_timecop_datetime(TSRMLS_C);

if (TIMECOP_G(func_override)) {
if (SUCCESS != timecop_func_override(TSRMLS_C) ||
SUCCESS != timecop_class_override(TSRMLS_C)) {
return FAILURE;
}
}




return SUCCESS;
}
/* }}} */
Expand Down Expand Up @@ -319,13 +315,14 @@ PHP_MINFO_FUNCTION(timecop)
{
php_info_print_table_start();
php_info_print_table_header(2, "timecop", "enabled");
php_info_print_table_row(2, "Version", PHP_TIMECOP_VERSION);
php_info_print_table_end();

DISPLAY_INI_ENTRIES();
}
/* }}} */

static int init_timecop_datetime(TSRMLS_D)
static int register_timecop_classes(TSRMLS_D)
{
zend_class_entry **pce;
zend_class_entry ce;
Expand Down

0 comments on commit 5604697

Please sign in to comment.