[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/main.c trunk/main/main.c

2011-04-19 Thread Pierre Joye
pajoye   Tue, 19 Apr 2011 21:43:22 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=310369

Log:
- fix build (btw, has novell man pages too?)

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

Modified: php/php-src/branches/PHP_5_3/main/main.c
===
--- php/php-src/branches/PHP_5_3/main/main.c2011-04-19 18:57:55 UTC (rev 
310368)
+++ php/php-src/branches/PHP_5_3/main/main.c2011-04-19 21:43:22 UTC (rev 
310369)
@@ -1938,7 +1938,9 @@
REGISTER_MAIN_STRINGL_CONSTANT(PHP_EXTENSION_DIR, PHP_EXTENSION_DIR, 
sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_PREFIX, PHP_PREFIX, 
sizeof(PHP_PREFIX)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_BINDIR, PHP_BINDIR, 
sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS);
+#ifndef PHP_WIN32
REGISTER_MAIN_STRINGL_CONSTANT(PHP_MANDIR, PHP_MANDIR, 
sizeof(PHP_MANDIR)-1, CONST_PERSISTENT | CONST_CS);
+#endif
REGISTER_MAIN_STRINGL_CONSTANT(PHP_LIBDIR, PHP_LIBDIR, 
sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_DATADIR, PHP_DATADIR, 
sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_SYSCONFDIR, PHP_SYSCONFDIR, 
sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);

Modified: php/php-src/trunk/main/main.c
===
--- php/php-src/trunk/main/main.c   2011-04-19 18:57:55 UTC (rev 310368)
+++ php/php-src/trunk/main/main.c   2011-04-19 21:43:22 UTC (rev 310369)
@@ -1863,7 +1863,13 @@
 #else
php_os=PHP_OS;
 #endif
-
+   {
+   char dll_dir[MAX_PATH];
+   sprintf(dll_dir, %s\\%s, module_path, ..\\..\\deps\\bin);
+   SetDllDirectory(dll_dir);
+   }
+// GetModuleFileName (NULL, module_path, MAX_PATH);
+//__debugbreak();
 #ifdef ZTS
tsrm_ls = ts_resource(0);
 #endif
@@ -1979,7 +1985,9 @@
REGISTER_MAIN_STRINGL_CONSTANT(PHP_EXTENSION_DIR, PHP_EXTENSION_DIR, 
sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_PREFIX, PHP_PREFIX, 
sizeof(PHP_PREFIX)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_BINDIR, PHP_BINDIR, 
sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS);
+#ifndef PHP_WIN32
REGISTER_MAIN_STRINGL_CONSTANT(PHP_MANDIR, PHP_MANDIR, 
sizeof(PHP_MANDIR)-1, CONST_PERSISTENT | CONST_CS);
+#endif
REGISTER_MAIN_STRINGL_CONSTANT(PHP_LIBDIR, PHP_LIBDIR, 
sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_DATADIR, PHP_DATADIR, 
sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT(PHP_SYSCONFDIR, PHP_SYSCONFDIR, 
sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/main.c trunk/main/main.c

2011-01-19 Thread Pierre Joye
pajoye   Thu, 20 Jan 2011 06:23:35 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307610

Log:
- check if strdup succeeds

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

Modified: php/php-src/branches/PHP_5_3/main/main.c
===
--- php/php-src/branches/PHP_5_3/main/main.c2011-01-20 01:59:14 UTC (rev 
307609)
+++ php/php-src/branches/PHP_5_3/main/main.c2011-01-20 06:23:35 UTC (rev 
307610)
@@ -179,7 +179,9 @@
}

e = PG(disable_functions) = strdup(INI_STR(disable_functions));
-
+   if (e == NULL) {
+   return;
+   }
while (*e) {
switch (*e) {
case ' ':
@@ -1672,8 +1674,9 @@
 {
 #ifdef PHP_WIN32
if (!PG(com_initialized)) {
-   CoInitialize(NULL);
-   PG(com_initialized) = 1;
+   if (CoInitialize(NULL) == S_OK) {
+   PG(com_initialized) = 1;
+   }
}
 #endif
 }

Modified: php/php-src/trunk/main/main.c
===
--- php/php-src/trunk/main/main.c   2011-01-20 01:59:14 UTC (rev 307609)
+++ php/php-src/trunk/main/main.c   2011-01-20 06:23:35 UTC (rev 307610)
@@ -180,7 +180,9 @@
}

e = PG(disable_functions) = strdup(INI_STR(disable_functions));
-
+   if (e == NULL) {
+   return;
+   }
while (*e) {
switch (*e) {
case ' ':
@@ -1715,8 +1717,9 @@
 {
 #ifdef PHP_WIN32
if (!PG(com_initialized)) {
-   CoInitialize(NULL);
-   PG(com_initialized) = 1;
+   if (CoInitialize(NULL) == S_OK) {
+   PG(com_initialized) = 1;
+   }
}
 #endif
 }
@@ -1820,6 +1823,7 @@
}
 }
 #endif
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;

 /* {{{ php_module_startup
  */
@@ -1835,6 +1839,10 @@
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);
WSADATA wsaData;
@@ -1854,7 +1862,15 @@
 #else
php_os=PHP_OS;
 #endif
-
+   GetModuleFileName((HINSTANCE)__ImageBase, module_path, MAX_PATH);
+   php_dirname(module_path, strlen(module_path));
+   {
+   char dll_dir[MAX_PATH];
+   sprintf(dll_dir, %s\\%s, module_path, ..\\..\\deps\\bin);
+   SetDllDirectory(dll_dir);
+   }
+// GetModuleFileName (NULL, module_path, MAX_PATH);
+//__debugbreak();
 #ifdef ZTS
tsrm_ls = ts_resource(0);
 #endif

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/main.c trunk/main/main.c

2009-10-13 Thread Stanislav Malyshev
stas Tue, 13 Oct 2009 19:58:59 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=289621

Log:
fix crash for bug #47627

Bug: http://bugs.php.net/47627 (Bogus) No input file specified causing crash
  
Changed paths:
U   php/php-src/branches/PHP_5_3/main/main.c
U   php/php-src/trunk/main/main.c

Modified: php/php-src/branches/PHP_5_3/main/main.c
===
--- php/php-src/branches/PHP_5_3/main/main.c2009-10-13 18:39:00 UTC (rev 
289620)
+++ php/php-src/branches/PHP_5_3/main/main.c2009-10-13 19:58:59 UTC (rev 
289621)
@@ -649,6 +649,10 @@
char *message;
int is_function = 0;

+   if(!ZEND_CAN_REPORT(type)) {
+   return;
+   }
+
/* get error text into buffer and escape for html if necessary */
buffer_len = vspprintf(buffer, 0, format, args);
if (PG(html_errors)) {
@@ -836,6 +840,9 @@
char *params;
va_list args;

+   if(!ZEND_CAN_REPORT(type)) {
+   return;
+   }
spprintf(params, 0, %s,%s, param1, param2);
va_start(args, format);
php_verror(docref, params ? params : ..., type, format, args 
TSRMLS_CC);
@@ -2164,7 +2171,9 @@
char realfile[MAXPATHLEN];

 #ifdef PHP_WIN32
-   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   if(primary_file-filename) {
+   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   }
 #endif

PG(during_request_startup) = 0;
@@ -2254,7 +2263,9 @@

zend_try {
 #ifdef PHP_WIN32
-   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   if(primary_file-filename) {
+   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   }
 #endif

PG(during_request_startup) = 0;

Modified: php/php-src/trunk/main/main.c
===
--- php/php-src/trunk/main/main.c   2009-10-13 18:39:00 UTC (rev 289620)
+++ php/php-src/trunk/main/main.c   2009-10-13 19:58:59 UTC (rev 289621)
@@ -2283,7 +2283,9 @@
char realfile[MAXPATHLEN];

 #ifdef PHP_WIN32
-   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   if(primary_file-filename) {
+   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   }
 #endif

PG(during_request_startup) = 0;
@@ -2372,7 +2374,9 @@

zend_try {
 #ifdef PHP_WIN32
-   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   if(primary_file-filename) {
+   UpdateIniFromRegistry(primary_file-filename TSRMLS_CC);
+   }
 #endif

PG(during_request_startup) = 0;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/main.c trunk/main/main.c

2009-09-04 Thread Jani Taskinen
jani Fri, 04 Sep 2009 11:02:40 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=288038

Log:
I have no idea. This might or might not fix a bug in some branch. At least it 
works.

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

Modified: php/php-src/branches/PHP_5_3/main/main.c
===
--- php/php-src/branches/PHP_5_3/main/main.c2009-09-04 10:21:17 UTC (rev 
288037)
+++ php/php-src/branches/PHP_5_3/main/main.c2009-09-04 11:02:40 UTC (rev 
288038)
@@ -1927,33 +1927,6 @@
return FAILURE;
}

-   /* Check for deprecated directives */
-   {
-   static const char *directives[] = {
-   define_syslog_variables,
-   register_globals,
-   register_long_arrays,
-   safe_mode,
-   magic_quotes_gpc,
-   magic_quotes_runtime,
-   magic_quotes_sybase,
-   NULL};
-   const char **p = directives;
-   long val;
-
-   while (*p) {
-   if (cfg_get_long((char*)*p, val) == SUCCESS  val) {
-   zend_error(E_WARNING, Directive '%s' is 
deprecated in PHP 5.3 and greater, *p);
-   }
-   ++p;
-   }
-
-   /* This is not too nice, but since its the only one theres no 
need for extra stuff here */
-   if (cfg_get_long(zend.ze1_compatibility_mode, val) == 
SUCCESS  val) {
-   zend_error(E_ERROR, zend.ze1_compatibility_mode is no 
longer supported in PHP 5.3 and greater);
-   }
-   }
-
/* Register PHP core ini entries */
REGISTER_INI_ENTRIES();

@@ -2047,6 +2020,34 @@

shutdown_memory_manager(1, 0 TSRMLS_CC);

+   /* Check for deprecated directives */
+   {
+   static const char *directives[] = {
+   define_syslog_variables,
+   register_globals,
+   register_long_arrays,
+   safe_mode,
+   magic_quotes_gpc,
+   magic_quotes_runtime,
+   magic_quotes_sybase,
+   NULL
+   };
+   const char **p = directives;
+   long val;
+
+   while (*p) {
+   if (cfg_get_long((char*)*p, val) == SUCCESS  val) {
+   zend_error(E_WARNING, Directive '%s' is 
deprecated in PHP 5.3 and greater, *p);
+   }
+   ++p;
+   }
+
+   /* This is not too nice, but since its the only one theres no 
need for extra stuff here */
+   if (cfg_get_long(zend.ze1_compatibility_mode, val) == 
SUCCESS  val) {
+   zend_error(E_ERROR, zend.ze1_compatibility_mode is no 
longer supported in PHP 5.3 and greater);
+   }
+   }
+
/* we're done */
return SUCCESS;
 }

Modified: php/php-src/trunk/main/main.c
===
--- php/php-src/trunk/main/main.c   2009-09-04 10:21:17 UTC (rev 288037)
+++ php/php-src/trunk/main/main.c   2009-09-04 11:02:40 UTC (rev 288038)
@@ -1473,7 +1473,7 @@
zend_set_timeout(PG(max_input_time), 1);
}

-   /* Disable realpath cache if safe_mode or open_basedir are set 
*/
+   /* Disable realpath cache if open_basedir is set */
if (PG(open_basedir)  *PG(open_basedir)) {
CWDG(realpath_cache_size_limit) = 0;
}
@@ -2040,7 +2040,7 @@
return FAILURE;
}

-   /* Check for deprecated directives */
+   /* Check for removed directives */
{
static const char *directives[] = {
define_syslog_variables,
@@ -2051,13 +2051,14 @@
magic_quotes_runtime,
magic_quotes_sybase,
zend.ze1_compatibility_mode,
-   NULL};
+   NULL
+   };
const char **p = directives;
long val;

while (*p) {
if (cfg_get_long((char*)*p, val) == SUCCESS  val) {
-   zend_error(E_WARNING, Directive '%s' is no 
longer supported in PHP 6 and greater, *p);
+   zend_error(E_ERROR, Directive '%s' no longer 
exist in PHP 6 and greater, *p);
}
++p;
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/main.c trunk/main/main.c

2009-07-28 Thread Stanislav Malyshev
stas Wed, 29 Jul 2009 00:17:10 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=286478

Log:
fix extension functions disabling (bug #49065)

Bug: http://bugs.php.net/49065 (Verified) disable_functions php.ini option 
does not work on Zend extensions
  
Changed paths:
U   php/php-src/branches/PHP_5_3/main/main.c
U   php/php-src/trunk/main/main.c

Modified: php/php-src/branches/PHP_5_3/main/main.c
===
--- php/php-src/branches/PHP_5_3/main/main.c2009-07-28 23:59:55 UTC (rev 
286477)
+++ php/php-src/branches/PHP_5_3/main/main.c2009-07-29 00:17:10 UTC (rev 
286478)
@@ -2006,10 +2006,6 @@
php_ini_register_extensions(TSRMLS_C);
zend_startup_modules(TSRMLS_C);

-   /* disable certain classes and functions as requested by php.ini */
-   php_disable_functions(TSRMLS_C);
-   php_disable_classes(TSRMLS_C);
-
/* start Zend extensions */
zend_startup_extensions();

@@ -2022,12 +2018,17 @@
}
}

+   /* disable certain classes and functions as requested by php.ini */
+   php_disable_functions(TSRMLS_C);
+   php_disable_classes(TSRMLS_C);
+
/* make core report what it should */
if (zend_hash_find(module_registry, core, sizeof(core), 
(void**)module)==SUCCESS) {
module-version = PHP_VERSION;
module-info_func = PHP_MINFO(php_core);
}

+
 #ifdef PHP_WIN32
/* Disable incompatible functions for the running platform */
if (php_win32_disable_functions() == FAILURE) {

Modified: php/php-src/trunk/main/main.c
===
--- php/php-src/trunk/main/main.c   2009-07-28 23:59:55 UTC (rev 286477)
+++ php/php-src/trunk/main/main.c   2009-07-29 00:17:10 UTC (rev 286478)
@@ -2121,10 +2121,6 @@
php_ini_register_extensions(TSRMLS_C);
zend_startup_modules(TSRMLS_C);

-   /* disable certain classes and functions as requested by php.ini */
-   php_disable_functions(TSRMLS_C);
-   php_disable_classes(TSRMLS_C);
-
/* start Zend extensions */
zend_startup_extensions();

@@ -2137,12 +2133,17 @@
}
}

+   /* disable certain classes and functions as requested by php.ini */
+   php_disable_functions(TSRMLS_C);
+   php_disable_classes(TSRMLS_C);
+
/* make core report what it should */
if (zend_hash_find(module_registry, core, sizeof(core), 
(void**)module)==SUCCESS) {
module-version = PHP_VERSION;
module-info_func = PHP_MINFO(php_core);
}

+
 #ifdef PHP_WIN32
/* Disable incompatible functions for the running platform */
if (php_win32_disable_functions() == FAILURE) {

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