File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -396,13 +396,35 @@ int php_init_config(TSRMLS_D)
396
396
static const char paths_separator [] = { ZEND_PATHS_SEPARATOR , 0 };
397
397
#ifdef PHP_WIN32
398
398
char * reg_location ;
399
+ char phprc_path [MAXPATHLEN ];
399
400
#endif
400
401
401
402
env_location = getenv ("PHPRC" );
403
+
404
+ #ifdef PHP_WIN32
402
405
if (!env_location ) {
403
- env_location = "" ;
406
+ char dummybuf ;
407
+ int size ;
408
+
409
+ SetLastError (0 );
410
+
411
+ /*If the given bugger is not large enough to hold the data, the return value is
412
+ the buffer size, in characters, required to hold the string and its terminating
413
+ null character. We use this return value to alloc the final buffer. */
414
+ size = GetEnvironmentVariableA ("PHPRC" , & dummybuf , 0 );
415
+ if (GetLastError () == ERROR_ENVVAR_NOT_FOUND ) {
416
+ /* The environment variable doesn't exist. */
417
+ env_location = "" ;
418
+ } else {
419
+ if (size == 0 ) {
420
+ env_location = "" ;
421
+ } else {
422
+ size = GetEnvironmentVariableA ("PHPRC" , phprc_path , size );
423
+ env_location = phprc_path ;
424
+ }
425
+ }
404
426
}
405
-
427
+ #endif
406
428
/*
407
429
* Prepare search path
408
430
*/
You can’t perform that action at this time.
0 commit comments