Skip to content

Commit 751d19f

Browse files
author
George Wang
committed
[BUGFIX] fixes the issue that a value from .user.ini displays in phpinfo(), but not applies.
[BUGFIX] when lsapi used the php_value has higher priority then ini_set when called from the script by itself .
1 parent 604827b commit 751d19f

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

sapi/litespeed/lsapi_main.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,17 +404,26 @@ static void log_message (const char *fmt, ...)
404404
#define DEBUG_MESSAGE(fmt, ...)
405405
#endif
406406

407+
static int lsapi_activate_user_ini(TSRMLS_D);
408+
409+
static int sapi_lsapi_activate(TSRMLS_D)
410+
{
411+
if (parse_user_ini && lsapi_activate_user_ini(TSRMLS_C) == FAILURE) {
412+
return FAILURE;
413+
}
414+
return SUCCESS;
415+
}
407416
/* {{{ sapi_module_struct cgi_sapi_module
408417
*/
409418
static sapi_module_struct lsapi_sapi_module =
410419
{
411420
"litespeed",
412-
"LiteSpeed V6.10",
421+
"LiteSpeed V6.11",
413422

414423
php_lsapi_startup, /* startup */
415424
php_module_shutdown_wrapper, /* shutdown */
416425

417-
NULL, /* activate */
426+
sapi_lsapi_activate, /* activate */
418427
sapi_lsapi_deactivate, /* deactivate */
419428

420429
sapi_lsapi_ub_write, /* unbuffered write */
@@ -547,8 +556,6 @@ static int lsapi_execute_script( zend_file_handle * file_handle)
547556

548557
}
549558

550-
static int lsapi_activate_user_ini();
551-
552559
static int lsapi_module_main(int show_source)
553560
{
554561
zend_file_handle file_handle = {0};
@@ -557,10 +564,6 @@ static int lsapi_module_main(int show_source)
557564
return -1;
558565
}
559566

560-
if (parse_user_ini && lsapi_activate_user_ini() == FAILURE) {
561-
return -1;
562-
}
563-
564567
if (show_source) {
565568
zend_syntax_highlighter_ini syntax_highlighter_ini;
566569

@@ -584,11 +587,16 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
584587
zend_string * psKey;
585588
#endif
586589
int type = ZEND_INI_PERDIR;
590+
int stage = PHP_INI_STAGE_RUNTIME;
587591
if ( '\001' == *pKey ) {
588592
++pKey;
589593
if ( *pKey == 4 ) {
590594
type = ZEND_INI_SYSTEM;
591595
}
596+
else
597+
{
598+
stage = PHP_INI_STAGE_HTACCESS;
599+
}
592600
++pKey;
593601
--keyLen;
594602
if (( keyLen == 7 )&&( strncasecmp( pKey, "engine", 6 )== 0 ))
@@ -603,12 +611,12 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
603611
psKey = zend_string_init(pKey, keyLen, 1);
604612
zend_alter_ini_entry_chars(psKey,
605613
(char *)pValue, valLen,
606-
type, PHP_INI_STAGE_ACTIVATE);
614+
type, stage);
607615
zend_string_release(psKey);
608616
#else
609617
zend_alter_ini_entry((char *)pKey, keyLen,
610618
(char *)pValue, valLen,
611-
type, PHP_INI_STAGE_ACTIVATE);
619+
type, stage);
612620
#endif
613621
}
614622
}

0 commit comments

Comments
 (0)