[PHP-CVS] cvs: php-src /sapi/embed php_embed.c

2008-03-25 Thread Marcus Boerger
helly   Tue Mar 25 22:04:58 2008 UTC

  Modified files:  
/php-src/sapi/embed php_embed.c 
  Log:
  - Fix memory leak found by Osman
  - Merge strlen to sizof change from CLI
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.24r2=1.25diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.24 php-src/sapi/embed/php_embed.c:1.25
--- php-src/sapi/embed/php_embed.c:1.24 Wed Mar 19 16:37:49 2008
+++ php-src/sapi/embed/php_embed.c  Tue Mar 25 22:04:58 2008
@@ -15,7 +15,7 @@
| Author: Edin Kadribasic [EMAIL PROTECTED]  |
+--+
 */
-/* $Id: php_embed.c,v 1.24 2008/03/19 16:37:49 rasmus Exp $ */
+/* $Id: php_embed.c,v 1.25 2008/03/25 22:04:58 helly Exp $ */
 
 #include php_embed.h
 #include ext/standard/dl.h
@@ -25,13 +25,13 @@
 #include fcntl.h
 #endif
 
-#define HARDCODED_INI  \
-   html_errors=0\n   \
-   register_argc_argv=1\n\
-   implicit_flush=1\n\
-   output_buffering=0\n  \
-   max_execution_time=0\n\
-   max_input_time=-1\n
+const char HARDCODED_INI[] =
+   html_errors=0\n
+   register_argc_argv=1\n
+   implicit_flush=1\n
+   output_buffering=0\n
+   max_execution_time=0\n
+   max_input_time=-1\n\0;
 
 static char* php_embed_read_cookies(TSRMLS_D)
 {
@@ -158,7 +158,6 @@
 #ifdef ZTS
void ***tsrm_ls = NULL;
 #endif
-   int ini_entries_len = 0;
 
 #ifdef HAVE_SIGNAL_H
 #if defined(SIGPIPE)  defined(SIG_IGN)
@@ -171,6 +170,14 @@
 #endif
 #endif
 
+#ifdef ZTS
+  tsrm_startup(1, 1, 0, NULL);
+  tsrm_ls = ts_resource(0);
+  *ptsrm_ls = tsrm_ls;
+#endif
+
+  sapi_startup(php_embed_module);
+
 #ifdef PHP_WIN32
   _fmode = _O_BINARY;  /*sets default for file streams to 
binary */
   setmode(_fileno(stdin), O_BINARY);   /* make the stdio mode be 
binary */
@@ -178,21 +185,11 @@
   setmode(_fileno(stderr), O_BINARY);  /* make the stdio mode be 
binary */
 #endif
 
-#ifdef ZTS
-  tsrm_startup(1, 1, 0, NULL);
-  tsrm_ls = ts_resource(0);
-  *ptsrm_ls = tsrm_ls;
-#endif
+  php_embed_module.ini_entries = malloc(sizeof(HARDCODED_INI));
+  memcpy(php_embed_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
 
   php_embed_module.additional_functions = additional_functions;
 
-  ini_entries_len = strlen(HARDCODED_INI);
-  php_embed_module.ini_entries = malloc(ini_entries_len+2);
-  memcpy(php_embed_module.ini_entries, HARDCODED_INI, ini_entries_len+1);
-  php_embed_module.ini_entries[ini_entries_len+1] = 0;
-
-  sapi_startup(php_embed_module);
-
   if (argv) {
php_embed_module.executable_location = argv[0];
   }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /sapi/embed php_embed.c

2007-08-08 Thread Stanislav Malyshev
stasWed Aug  8 21:08:51 2007 UTC

  Modified files:  
/php-src/sapi/embed php_embed.c 
  Log:
  fix TSRM embed startup
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.18r2=1.19diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.18 php-src/sapi/embed/php_embed.c:1.19
--- php-src/sapi/embed/php_embed.c:1.18 Thu Aug  2 23:49:50 2007
+++ php-src/sapi/embed/php_embed.c  Wed Aug  8 21:08:51 2007
@@ -15,7 +15,7 @@
| Author: Edin Kadribasic [EMAIL PROTECTED]  |
+--+
 */
-/* $Id: php_embed.c,v 1.18 2007/08/02 23:49:50 stas Exp $ */
+/* $Id: php_embed.c,v 1.19 2007/08/08 21:08:51 stas Exp $ */
 
 #include php_embed.h
 #include ext/standard/dl.h
@@ -155,9 +155,6 @@
 {
zend_llist global_vars;
 #ifdef ZTS
-   zend_compiler_globals *compiler_globals;
-   zend_executor_globals *executor_globals;
-   php_core_globals *core_globals;
sapi_globals_struct *sapi_globals;
void ***tsrm_ls;
 #endif
@@ -185,15 +182,6 @@
   tsrm_startup(1, 1, 0, NULL);
 #endif
 
-#ifdef ZTS
-  compiler_globals = ts_resource(compiler_globals_id);
-  executor_globals = ts_resource(executor_globals_id);
-  core_globals = ts_resource(core_globals_id);
-  sapi_globals = ts_resource(sapi_globals_id);
-  tsrm_ls = ts_resource(0);
-  *ptsrm_ls = tsrm_ls;
-#endif
-
   php_embed_module.additional_functions = additional_functions;
 
   ini_entries_len = strlen(HARDCODED_INI);
@@ -203,24 +191,24 @@
 
   sapi_startup(php_embed_module);
 
+  if (argv) {
+   php_embed_module.executable_location = argv[0];
+  }
+
   if (php_embed_module.startup(php_embed_module)==FAILURE) {
  return FAILURE;
   }
  
-  if (argv) {
-   php_embed_module.executable_location = argv[0];
-  }
+#ifdef ZTS
+  sapi_globals = ts_resource(sapi_globals_id);
+  tsrm_ls = ts_resource(0);
+  *ptsrm_ls = tsrm_ls;
+#endif
 
   zend_llist_init(global_vars, sizeof(char *), NULL, 0);  
 
   /* Set some Embedded PHP defaults */
   SG(options) |= SAPI_OPTION_NO_CHDIR;
-#if 0
-//  zend_alter_ini_entry(register_argc_argv, 19, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-//  zend_alter_ini_entry(html_errors, 12, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-//  zend_alter_ini_entry(implicit_flush, 15, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-//  zend_alter_ini_entry(max_execution_time, 19, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-#endif
   SG(request_info).argc=argc;
   SG(request_info).argv=argv;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /sapi/embed php_embed.c

2007-08-08 Thread Stanislav Malyshev
stasWed Aug  8 21:14:11 2007 UTC

  Modified files:  
/php-src/sapi/embed php_embed.c 
  Log:
  initialize variables
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.19r2=1.20diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.19 php-src/sapi/embed/php_embed.c:1.20
--- php-src/sapi/embed/php_embed.c:1.19 Wed Aug  8 21:08:51 2007
+++ php-src/sapi/embed/php_embed.c  Wed Aug  8 21:14:11 2007
@@ -15,7 +15,7 @@
| Author: Edin Kadribasic [EMAIL PROTECTED]  |
+--+
 */
-/* $Id: php_embed.c,v 1.19 2007/08/08 21:08:51 stas Exp $ */
+/* $Id: php_embed.c,v 1.20 2007/08/08 21:14:11 stas Exp $ */
 
 #include php_embed.h
 #include ext/standard/dl.h
@@ -155,8 +155,8 @@
 {
zend_llist global_vars;
 #ifdef ZTS
-   sapi_globals_struct *sapi_globals;
-   void ***tsrm_ls;
+   sapi_globals_struct *sapi_globals = NULL;
+   void ***tsrm_ls = NULL;
 #endif
int ini_entries_len = 0;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /sapi/embed php_embed.c

2007-08-02 Thread Stanislav Malyshev
stasThu Aug  2 23:49:51 2007 UTC

  Modified files:  
/php-src/sapi/embed php_embed.c 
  Log:
  use hardcoded INI like CLI
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.17r2=1.18diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.17 php-src/sapi/embed/php_embed.c:1.18
--- php-src/sapi/embed/php_embed.c:1.17 Mon Jan  1 09:29:36 2007
+++ php-src/sapi/embed/php_embed.c  Thu Aug  2 23:49:50 2007
@@ -15,7 +15,7 @@
| Author: Edin Kadribasic [EMAIL PROTECTED]  |
+--+
 */
-/* $Id: php_embed.c,v 1.17 2007/01/01 09:29:36 sebastian Exp $ */
+/* $Id: php_embed.c,v 1.18 2007/08/02 23:49:50 stas Exp $ */
 
 #include php_embed.h
 #include ext/standard/dl.h
@@ -25,6 +25,14 @@
 #include fcntl.h
 #endif
 
+#define HARDCODED_INI  \
+   html_errors=0\n   \
+   register_argc_argv=1\n\
+   implicit_flush=1\n\
+   output_buffering=0\n  \
+   max_execution_time=0\n\
+   max_input_time=-1\n
+
 static char* php_embed_read_cookies(TSRMLS_D)
 {
return NULL;
@@ -153,6 +161,7 @@
sapi_globals_struct *sapi_globals;
void ***tsrm_ls;
 #endif
+   int ini_entries_len = 0;
 
 #ifdef HAVE_SIGNAL_H
 #if defined(SIGPIPE)  defined(SIG_IGN)
@@ -186,6 +195,12 @@
 #endif
 
   php_embed_module.additional_functions = additional_functions;
+
+  ini_entries_len = strlen(HARDCODED_INI);
+  php_embed_module.ini_entries = malloc(ini_entries_len+2);
+  memcpy(php_embed_module.ini_entries, HARDCODED_INI, ini_entries_len+1);
+  php_embed_module.ini_entries[ini_entries_len+1] = 0;
+
   sapi_startup(php_embed_module);
 
   if (php_embed_module.startup(php_embed_module)==FAILURE) {
@@ -200,11 +215,12 @@
 
   /* Set some Embedded PHP defaults */
   SG(options) |= SAPI_OPTION_NO_CHDIR;
-  zend_alter_ini_entry(register_argc_argv, 19, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-  zend_alter_ini_entry(html_errors, 12, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-  zend_alter_ini_entry(implicit_flush, 15, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-  zend_alter_ini_entry(max_execution_time, 19, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
-
+#if 0
+//  zend_alter_ini_entry(register_argc_argv, 19, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
+//  zend_alter_ini_entry(html_errors, 12, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
+//  zend_alter_ini_entry(implicit_flush, 15, 1, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
+//  zend_alter_ini_entry(max_execution_time, 19, 0, 1, PHP_INI_SYSTEM, 
PHP_INI_STAGE_ACTIVATE);
+#endif
   SG(request_info).argc=argc;
   SG(request_info).argv=argv;
 
@@ -228,6 +244,10 @@
 #ifdef ZTS
 tsrm_shutdown();
 #endif
+   if (php_embed_module.ini_entries) {
+   free(php_embed_module.ini_entries);
+   php_embed_module.ini_entries = NULL;
+   }
 }
 
 /*

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /sapi/embed php_embed.c

2006-12-28 Thread Antony Dovgal
tony2001Thu Dec 28 15:22:07 2006 UTC

  Modified files:  
/php-src/sapi/embed php_embed.c 
  Log:
  fix sapi/embed build
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.15r2=1.16diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.15 php-src/sapi/embed/php_embed.c:1.16
--- php-src/sapi/embed/php_embed.c:1.15 Sun Jun 25 19:17:20 2006
+++ php-src/sapi/embed/php_embed.c  Thu Dec 28 15:22:07 2006
@@ -15,9 +15,10 @@
| Author: Edin Kadribasic [EMAIL PROTECTED]  |
+--+
 */
-/* $Id: php_embed.c,v 1.15 2006/06/25 19:17:20 bjori Exp $ */
+/* $Id: php_embed.c,v 1.16 2006/12/28 15:22:07 tony2001 Exp $ */
 
 #include php_embed.h
+#include ext/standard/dl.h
 
 #ifdef PHP_WIN32
 #include io.h

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php