Re: [PHP-CVS] cvs: php4 /main main.c

2003-03-31 Thread Marcus Börger
At 15:54 31.03.2003, Andrei Zmievski wrote:
On Sun, 30 Mar 2003, Marcus Boerger wrote:
>  /* {{{ includes
>   */
> @@ -575,6 +575,8 @@
>
>  /* {{{ php_error_cb
>   extended error handling function */
> +#define NO_NULL_STR(x) (x?x:"")
> +
Why not use STR_PRINT()?


good question?

I'll change it

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


Re: [PHP-CVS] cvs: php4 /main main.c

2003-03-31 Thread Andrei Zmievski
On Sun, 30 Mar 2003, Marcus Boerger wrote:
>  /* {{{ includes
>   */
> @@ -575,6 +575,8 @@
>  
>  /* {{{ php_error_cb
>   extended error handling function */
> +#define NO_NULL_STR(x) (x?x:"")
> +

Why not use STR_PRINT()?

-Andrei   http://www.gravitonic.com/

I must say I find television very educational. The minute
somebody turns it on, I go to the library and read a good book.
   - Groucho Marx

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



Re: [PHP-CVS] cvs: php4 /main main.c

2003-02-15 Thread Derick Rethans
On Sat, 15 Feb 2003, Jani Taskinen wrote:

> sniperSat Feb 15 15:22:20 2003 EDT
> 
>   Modified files:  
> /php4/mainmain.c 
>   Log:
>   - Fix unsetting of open_basedir, safe_mode_exec_dir and user_dir with
> "php_admin_value  none"
>   - Fixes bug #0  

MFH?

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


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




Re: [PHP-CVS] cvs: php4 /main main.c

2002-12-18 Thread Andi Gutmans
You're making it quite ugly. Why not use tsrm_strtok_r() which is just like 
strtok_r() but available everywhere?

Andi

At 03:43 PM 12/16/2002 +, Ilia Alshanetsky wrote:
iliaa   Mon Dec 16 10:43:53 2002 EDT

  Modified files:
/php4/main  main.c
  Log:
  A better, strtok() free implementaion of php_disable_functions().


Index: php4/main/main.c
diff -u php4/main/main.c:1.519 php4/main/main.c:1.520
--- php4/main/main.c:1.519  Thu Dec  5 16:53:25 2002
+++ php4/main/main.cMon Dec 16 10:43:52 2002
@@ -18,7 +18,7 @@
+--+
 */

-/* $Id: main.c,v 1.519 2002/12/05 21:53:25 helly Exp $ */
+/* $Id: main.c,v 1.520 2002/12/16 15:43:52 iliaa Exp $ */

 /* {{{ includes
  */
@@ -168,15 +168,36 @@
  */
 static void php_disable_functions(TSRMLS_D)
 {
-   char *func;
-   char *new_value_dup = strdup(INI_STR("disable_functions")); /* 
This is an intentional leak,
- 
* it's not a big deal as it's process-wide
- 
*/
-
-   func = strtok(new_value_dup, ", ");
-   while (func) {
-   zend_disable_function(func, strlen(func) TSRMLS_CC);
-   func = strtok(NULL, ", ");
+   char *s = NULL;
+   char *e = INI_STR("disable_functions");
+   char p;
+
+   if (!*e) {
+   return;
+   }
+
+   while (*e) {
+   switch (*e) {
+   case ' ':
+   case ',':
+   if (s) {
+   p = *e;
+   *e = '\0';
+   zend_disable_function(s, e-s 
TSRMLS_CC);
+   *e = p;
+   s = NULL;
+   }
+   break;
+   default:
+   if (!s) {
+   s = e;
+   }
+   break;
+   }
+   e++;
+   }
+   if (s) {
+   zend_disable_function(s, e-s TSRMLS_CC);
}
 }
 /* }}} */



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


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




Re: [PHP-CVS] cvs: php4 /main main.c Zend zend.c zend.h zend_builtin_functions.c zend_execute.c zend_execute_API.c

2002-11-18 Thread Marcus Börger
I cannot compile with ZE2 any longer, due to this patch.
Apply to ZE2?

main/main.lo: In function `php_module_startup':
/usr/src/php4-HEAD/main/main.c:1195: undefined reference to 
`zend_register_standard_ini_entries'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

marcus

At 14:26 17.11.2002, Zeev Suraski wrote:
zeevSun Nov 17 08:26:37 2002 EDT

  Modified files:
/Zend   zend.c zend.h zend_builtin_functions.c zend_execute.c
zend_execute_API.c
/php4/main  main.c
  Log:
  Unify handling of error_reporting - fix bug #16137


Index: Zend/zend.c
diff -u Zend/zend.c:1.162 Zend/zend.c:1.163
--- Zend/zend.c:1.162   Fri Nov  1 17:19:55 2002
+++ Zend/zend.c Sun Nov 17 08:26:36 2002
@@ -59,6 +59,22 @@
 static int (*zend_get_configuration_directive_p)(char *name, uint 
name_length, zval *contents);


+static ZEND_INI_MH(OnUpdateErrorReporting)
+{
+   if (!new_value) {
+   EG(error_reporting) = E_ALL & ~E_NOTICE;
+   } else {
+   EG(error_reporting) = atoi(new_value);
+   }
+   return SUCCESS;
+}
+
+
+ZEND_INI_BEGIN()
+   ZEND_INI_ENTRY("error_reporting",   NULL, 
 ZEND_INI_ALL,   OnUpdateErrorReporting)
+ZEND_INI_END()
+
+
 #ifdef ZTS
 ZEND_API int compiler_globals_id;
 ZEND_API int executor_globals_id;
@@ -487,6 +503,14 @@
 #endif

return SUCCESS;
+}
+
+
+void zend_register_standard_ini_entries(TSRMLS_D)
+{
+   int module_number = 0;
+
+   REGISTER_INI_ENTRIES();
 }


Index: Zend/zend.h
diff -u Zend/zend.h:1.165 Zend/zend.h:1.166
--- Zend/zend.h:1.165   Thu Nov 14 00:41:32 2002
+++ Zend/zend.h Sun Nov 17 08:26:36 2002
@@ -17,7 +17,7 @@
+--+
 */

-/* $Id: zend.h,v 1.165 2002/11/14 05:41:32 sebastian Exp $ */
+/* $Id: zend.h,v 1.166 2002/11/17 13:26:36 zeev Exp $ */

 #ifndef ZEND_H
 #define ZEND_H
@@ -348,6 +348,7 @@

 int zend_startup(zend_utility_functions *utility_functions, char 
**extensions, int start_builtin_functions);
 void zend_shutdown(TSRMLS_D);
+void zend_register_standard_ini_entries(TSRMLS_D);

 #ifdef ZTS
 void zend_post_startup(TSRMLS_D);
Index: Zend/zend_builtin_functions.c
diff -u Zend/zend_builtin_functions.c:1.124 
Zend/zend_builtin_functions.c:1.125
--- Zend/zend_builtin_functions.c:1.124 Mon Oct 21 04:42:32 2002
+++ Zend/zend_builtin_functions.c   Sun Nov 17 08:26:37 2002
@@ -22,7 +22,7 @@
 #include "zend_API.h"
 #include "zend_builtin_functions.h"
 #include "zend_constants.h"
-
+#include "zend_ini.h"
 #undef ZEND_TEST_EXCEPTIONS

 static ZEND_FUNCTION(zend_version);
@@ -398,8 +398,8 @@
if (zend_get_parameters_ex(1, &arg) == FAILURE) {
RETURN_FALSE;
}
-   convert_to_long_ex(arg);
-   EG(error_reporting)=(*arg)->value.lval;
+   convert_to_string_ex(arg);
+   zend_alter_ini_entry("error_reporting", 
sizeof("error_reporting"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), 
ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
break;
default:
ZEND_WRONG_PARAM_COUNT();
Index: Zend/zend_execute.c
diff -u Zend/zend_execute.c:1.316 Zend/zend_execute.c:1.317
--- Zend/zend_execute.c:1.316   Mon Nov 11 13:27:32 2002
+++ Zend/zend_execute.c Sun Nov 17 08:26:37 2002
@@ -31,6 +31,7 @@
 #include "zend_extensions.h"
 #include "zend_fast_cache.h"
 #include "zend_execute_locks.h"
+#include "zend_ini.h"

 #define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, 
Ts, should_free TSRMLS_CC)
 #define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts 
TSRMLS_CC)
@@ -2424,10 +2425,16 @@
case ZEND_BEGIN_SILENCE:

EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = EG(error_reporting);

EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_LONG;  /* shouldn't be 
necessary */
-   EG(error_reporting) = 0;
+   zend_alter_ini_entry("error_reporting", 
sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
NEXT_OPCODE();
-   case ZEND_END_SILENCE:
-   EG(error_reporting) = 
EX(Ts)[EX(opline)->op1.u.var].tmp_var.value.lval;
+   case ZEND_END_SILENCE: {
+   zval restored_error_reporting;
+
+   restored_error_reporting.type = 
IS_LONG;
+ 
restored_error_reporting.value.lval = 
EX(Ts)[EX(opline)->op1.u.var].tmp_var.value.lval;
+ 
convert_to_string(&restored_error_reporting);
+ 
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), 
Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), 
ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+   }