Skip to content

mssql.compatability_mode fix #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions ext/mssql/php_mssql.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,12 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY_EX("mssql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_error_severity", "10", PHP_INI_ALL, OnUpdateLong, cfg_min_error_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.min_message_severity", "10", PHP_INI_ALL, OnUpdateLong, cfg_min_message_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatability_mode, zend_mssql_globals, mssql_globals)
/*
mssql.compatAbility_mode (with typo) was used for relatively long time.
Unless it is fixed the old version is also kept for compatibility reasons.
*/
STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatibility_mode, zend_mssql_globals, mssql_globals)
STD_PHP_INI_BOOLEAN("mssql.compatibility_mode", "0", PHP_INI_ALL, OnUpdateBool, compatibility_mode, zend_mssql_globals, mssql_globals)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I think we should support both names, make them refer to the same variable. Otherwise people will get surprises on upgrade if their php.ini has non-default values.

STD_PHP_INI_ENTRY_EX("mssql.connect_timeout", "5", PHP_INI_ALL, OnUpdateLong, connect_timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.timeout", "60", PHP_INI_ALL, OnUpdateLong, timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
STD_PHP_INI_ENTRY_EX("mssql.textsize", "-1", PHP_INI_ALL, OnUpdateLong, textsize, zend_mssql_globals, mssql_globals, display_text_size)
Expand Down Expand Up @@ -415,12 +420,12 @@ static void _mssql_bind_hash_dtor(void *data)
*/
static PHP_GINIT_FUNCTION(mssql)
{
long compatability_mode;
long compatibility_mode;

mssql_globals->num_persistent = 0;
mssql_globals->get_column_content = php_mssql_get_column_content_with_type;
if (cfg_get_long("mssql.compatability_mode", &compatability_mode) == SUCCESS) {
if (compatability_mode) {
if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) {
if (compatibility_mode) {
mssql_globals->get_column_content = php_mssql_get_column_content_without_type;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/mssql/php_mssql.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mssql)
long min_error_severity, min_message_severity;
long cfg_min_error_severity, cfg_min_message_severity;
long connect_timeout, timeout;
zend_bool compatability_mode;
zend_bool compatibility_mode;
void (*get_column_content)(mssql_link *mssql_ptr,int offset,zval *result,int column_type TSRMLS_DC);
long textsize, textlimit, batchsize;
zend_bool datetimeconvert;
Expand Down
2 changes: 1 addition & 1 deletion php.ini-development
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ mssql.min_error_severity = 10
mssql.min_message_severity = 10

; Compatibility mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
mssql.compatibility_mode = Off

; Connect timeout
;mssql.connect_timeout = 5
Expand Down
2 changes: 1 addition & 1 deletion php.ini-production
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ mssql.min_error_severity = 10
mssql.min_message_severity = 10

; Compatibility mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
mssql.compatibility_mode = Off

; Connect timeout
;mssql.connect_timeout = 5
Expand Down