pajoye                                   Tue, 13 Sep 2011 10:38:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=316594

Log:
- do not display the crt warnings anymore by default. It is enough to simply 
fail from a user land pov as it is the case on posix platforms

Changed paths:
    U   php/php-src/branches/PHP_5_4/UPGRADING
    U   php/php-src/branches/PHP_5_4/main/main.c
    U   php/php-src/trunk/main/main.c

Modified: php/php-src/branches/PHP_5_4/UPGRADING
===================================================================
--- php/php-src/branches/PHP_5_4/UPGRADING      2011-09-13 07:32:02 UTC (rev 
316593)
+++ php/php-src/branches/PHP_5_4/UPGRADING      2011-09-13 10:38:12 UTC (rev 
316594)
@@ -363,6 +363,9 @@
   three times.
 - Changed E_ALL to include E_STRICT. Recommended production value changed to
   E_ALL & ~E_DEPRECATED & ~E_STRICT.
+- a new directive, called windows_show_crt_warning, has been introduced.
+  This directive shows the CRT warnings when enabled. These warnings were
+  displayed by default until now. It is disabled by default.

 ====================
 12. Syntax additions

Modified: php/php-src/branches/PHP_5_4/main/main.c
===================================================================
--- php/php-src/branches/PHP_5_4/main/main.c    2011-09-13 07:32:02 UTC (rev 
316593)
+++ php/php-src/branches/PHP_5_4/main/main.c    2011-09-13 10:38:12 UTC (rev 
316594)
@@ -502,6 +502,9 @@
        STD_PHP_INI_ENTRY("user_ini.filename",          ".user.ini",    
PHP_INI_SYSTEM,         OnUpdateString,         user_ini_filename,      
php_core_globals,               core_globals)
        STD_PHP_INI_ENTRY("user_ini.cache_ttl",         "300",                  
PHP_INI_SYSTEM,         OnUpdateLong,           user_ini_cache_ttl,     
php_core_globals,               core_globals)
        STD_PHP_INI_BOOLEAN("exit_on_timeout",          "0",            
PHP_INI_ALL,            OnUpdateBool,                   exit_on_timeout,        
                php_core_globals,       core_globals)
+#ifdef PHP_WIN32
+       STD_PHP_INI_BOOLEAN("windows_show_crt_warning",         "0",            
PHP_INI_ALL,            OnUpdateBool,                   
windows_show_crt_warning,                       php_core_globals,       
core_globals)
+#endif
 PHP_INI_END()
 /* }}} */

@@ -1839,18 +1842,21 @@
        int len;

        if (!called) {
-               called = 1;
-               if (function) {
-                       if (file) {
-                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
parameter detected in CRT function '%ws' (%ws:%d)", function, file, line);
+               TSRMLS_FETCH();
+               if(PG(windows_show_crt_warning)) {
+                       called = 1;
+                       if (function) {
+                               if (file) {
+                                       len = _snprintf(buf, sizeof(buf)-1, 
"Invalid parameter detected in CRT function '%ws' (%ws:%d)", function, file, 
line);
+                               } else {
+                                       len = _snprintf(buf, sizeof(buf)-1, 
"Invalid parameter detected in CRT function '%ws'", function);
+                               }
                        } else {
-                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
parameter detected in CRT function '%ws'", function);
+                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
CRT parameter detected (function not known)");
                        }
-               } else {
-                       len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT 
parameters detected");
+                       zend_error(E_WARNING, "%s", buf);
+                       called = 0;
                }
-               zend_error(E_WARNING, "%s", buf);
-               called = 0;
        }
 }
 #endif

Modified: php/php-src/trunk/main/main.c
===================================================================
--- php/php-src/trunk/main/main.c       2011-09-13 07:32:02 UTC (rev 316593)
+++ php/php-src/trunk/main/main.c       2011-09-13 10:38:12 UTC (rev 316594)
@@ -502,6 +502,9 @@
        STD_PHP_INI_ENTRY("user_ini.filename",          ".user.ini",    
PHP_INI_SYSTEM,         OnUpdateString,         user_ini_filename,      
php_core_globals,               core_globals)
        STD_PHP_INI_ENTRY("user_ini.cache_ttl",         "300",                  
PHP_INI_SYSTEM,         OnUpdateLong,           user_ini_cache_ttl,     
php_core_globals,               core_globals)
        STD_PHP_INI_BOOLEAN("exit_on_timeout",          "0",            
PHP_INI_ALL,            OnUpdateBool,                   exit_on_timeout,        
                php_core_globals,       core_globals)
+#ifdef PHP_WIN32
+       STD_PHP_INI_BOOLEAN("windows_show_crt_warning",         "0",            
PHP_INI_ALL,            OnUpdateBool,                   
windows_show_crt_warning,                       php_core_globals,       
core_globals)
+#endif
 PHP_INI_END()
 /* }}} */

@@ -1839,18 +1842,21 @@
        int len;

        if (!called) {
-               called = 1;
-               if (function) {
-                       if (file) {
-                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
parameter detected in CRT function '%ws' (%ws:%d)", function, file, line);
+               TSRMLS_FETCH();
+               if(PG(windows_show_crt_warning)) {
+                       called = 1;
+                       if (function) {
+                               if (file) {
+                                       len = _snprintf(buf, sizeof(buf)-1, 
"Invalid parameter detected in CRT function '%ws' (%ws:%d)", function, file, 
line);
+                               } else {
+                                       len = _snprintf(buf, sizeof(buf)-1, 
"Invalid parameter detected in CRT function '%ws'", function);
+                               }
                        } else {
-                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
parameter detected in CRT function '%ws'", function);
+                               len = _snprintf(buf, sizeof(buf)-1, "Invalid 
CRT parameter detected (function not known)");
                        }
-               } else {
-                       len = _snprintf(buf, sizeof(buf)-1, "Invalid CRT 
parameters detected");
+                       zend_error(E_WARNING, "%s", buf);
+                       called = 0;
                }
-               zend_error(E_WARNING, "%s", buf);
-               called = 0;
        }
 }
 #endif
@@ -1869,9 +1875,6 @@
        void ***tsrm_ls;
        php_core_globals *core_globals;
 #endif
-#ifdef PHP_WIN32
-       char module_path[MAX_PATH];
-#endif

 #if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
        WORD wVersionRequested = MAKEWORD(2, 0);

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

Reply via email to