summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-08-14 23:30:49 +0400
committerDmitry Stogov <dmitry@zend.com>2014-08-14 23:30:49 +0400
commit7497c8793d928d2f025709d573150fb5e158ea9d (patch)
tree3b4584a0ad11966b8d413f2d661c22a768f31323
parent773d80c6df00b9bf6e9edd939c9b52d35395062e (diff)
parent37e91cc5d34598b05bcd377f3115f36b43e786ac (diff)
downloadphp-git-7497c8793d928d2f025709d573150fb5e158ea9d.tar.gz
Merge branch 'master' into phpng
* master: (51 commits) Update Git rules Back to -dev (with EOL notice in NEWS) new NEWS block for the next release It's 2014 already, fix copyright year where user visible PHP 5.3.29 Some changes were lost in the merge commit of #66091 Updated NEWS for #66091 Fixed #66091 Updated NEWS for #66091 Updated NEWS for #66091 Fixed #66091 updated NEWS updated NEWS updated NEWS backported the fix for bug #41577 NEWS entry for e6d93a1 / d73d44c restore FPM compatibility with mod_fastcgi broken since #694 / 67541, fixes bug 67606 Revert "Merge branch 'pull-request/694' into PHP-5.6" PHP 5.3.29RC1 Fix missing type checks in various functions ... Conflicts: ext/date/php_date.c ext/standard/math.c
-rw-r--r--README.GIT-RULES6
-rw-r--r--ext/com_dotnet/com_dotnet.c33
-rw-r--r--ext/date/php_date.c40
-rw-r--r--ext/standard/config.m42
-rw-r--r--ext/standard/math.c24
-rw-r--r--sapi/fpm/fpm/fpm_main.c28
6 files changed, 103 insertions, 30 deletions
diff --git a/README.GIT-RULES b/README.GIT-RULES
index 3df9d17bcd..d966093f25 100644
--- a/README.GIT-RULES
+++ b/README.GIT-RULES
@@ -51,9 +51,7 @@ Currently we have the following branches in use::
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
stable version and is open for bugfixes only.
- PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
- in extended support and open forsecurity fixes only. Triaged
- via security@php.net
+ PHP-5.3 This branch is closed.
PHP-5.2 This branch is closed.
@@ -63,7 +61,7 @@ Currently we have the following branches in use::
The next few rules are more of a technical nature::
- 1. All changes should first go to the lowest branch (i.e. 5.3) and then
+ 1. All changes should first go to the lowest branch (i.e. 5.4) and then
get merged up to all other branches. If a change is not needed for
later branches (i.e. fixes for features which where dropped from later
branches) an empty merge should be done.
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index c582309c28..9698fb3419 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -198,7 +198,8 @@ PHP_FUNCTION(com_dotnet_create_instance)
IUnknown *unk = NULL;
php_com_initialize(TSRMLS_C);
- if (COMG(dotnet_runtime_stuff) == NULL) {
+ stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
+ if (stuff == NULL) {
hr = dotnet_init(&where TSRMLS_CC);
if (FAILED(hr)) {
char buf[1024];
@@ -210,9 +211,35 @@ PHP_FUNCTION(com_dotnet_create_instance)
ZEND_CTOR_MAKE_NULL();
return;
}
- }
+ stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
- stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
+ } else if (stuff->dotnet_domain == NULL) {
+ where = "ICorRuntimeHost_GetDefaultDomain";
+ hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk);
+ if (FAILED(hr)) {
+ char buf[1024];
+ char *err = php_win32_error_to_msg(hr);
+ snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
+ if (err)
+ LocalFree(err);
+ php_com_throw_exception(hr, buf TSRMLS_CC);
+ ZVAL_NULL(object);
+ return;
+ }
+
+ where = "QI: System._AppDomain";
+ hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
+ if (FAILED(hr)) {
+ char buf[1024];
+ char *err = php_win32_error_to_msg(hr);
+ snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
+ if (err)
+ LocalFree(err);
+ php_com_throw_exception(hr, buf TSRMLS_CC);
+ ZVAL_NULL(object);
+ return;
+ }
+ }
obj = CDNO_FETCH(object);
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index cc0499da0b..6cea2af048 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2596,16 +2596,18 @@ PHP_FUNCTION(date_create)
zval *timezone_object = NULL;
char *time_str = NULL;
int time_str_len = 0;
+ zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
- if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
- zval_dtor(return_value);
+ php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
+ if (!php_date_initialize(Z_PHPDATE_P(&datetime_object), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+ zval_dtor(&datetime_object);
RETURN_FALSE;
}
+ RETVAL_ZVAL(&datetime_object, 0, 0);
}
/* }}} */
@@ -2617,16 +2619,18 @@ PHP_FUNCTION(date_create_immutable)
zval *timezone_object = NULL;
char *time_str = NULL;
int time_str_len = 0;
+ zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
- if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
- zval_dtor(return_value);
+ php_date_instantiate(date_ce_immutable, &datetime_object TSRMLS_CC);
+ if (!php_date_initialize(Z_PHPDATE_P(&datetime_object), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+ zval_dtor(&datetime_object);
RETURN_FALSE;
}
+ RETVAL_ZVAL(&datetime_object, 0, 0);
}
/* }}} */
@@ -2638,16 +2642,18 @@ PHP_FUNCTION(date_create_from_format)
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
int time_str_len = 0, format_str_len = 0;
+ zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
- if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
- zval_dtor(return_value);
+ php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
+ if (!php_date_initialize(Z_PHPDATE_P(&datetime_object), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+ zval_dtor(&datetime_object);
RETURN_FALSE;
}
+ RETVAL_ZVAL(&datetime_object, 0, 0);
}
/* }}} */
@@ -2659,16 +2665,18 @@ PHP_FUNCTION(date_create_immutable_from_format)
zval *timezone_object = NULL;
char *time_str = NULL, *format_str = NULL;
int time_str_len = 0, format_str_len = 0;
+ zval datetime_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
- if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
- zval_dtor(return_value);
+ php_date_instantiate(date_ce_immutable, &datetime_object TSRMLS_CC);
+ if (!php_date_initialize(Z_PHPDATE_P(&datetime_object), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+ zval_dtor(&datetime_object);
RETURN_FALSE;
}
+ RETVAL_ZVAL(&datetime_object, 0, 0);
}
/* }}} */
@@ -2738,7 +2746,7 @@ PHP_METHOD(DateTimeImmutable, createFromMutable)
}
/* }}} */
-static int php_date_initialize_from_hash(zval *return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC) /* {{{ */
+static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
{
zval *z_date;
zval *z_timezone;
@@ -2810,7 +2818,7 @@ PHP_METHOD(DateTime, __set_state)
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
dateobj = Z_PHPDATE_P(return_value);
- if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
+ if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
@@ -2832,7 +2840,7 @@ PHP_METHOD(DateTimeImmutable, __set_state)
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
dateobj = Z_PHPDATE_P(return_value);
- if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
+ if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTimeImmutable object");
}
}
@@ -2850,7 +2858,7 @@ PHP_METHOD(DateTime, __wakeup)
myht = Z_OBJPROP_P(object);
- if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
+ if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 3d00d88dda..67952163aa 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -338,7 +338,7 @@ fi
dnl
dnl Check for available functions
dnl
-AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
+AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p log2 hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
AC_FUNC_FNMATCH
dnl
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 74ebb83379..a392eb607c 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -792,15 +792,27 @@ PHP_FUNCTION(log)
if (ZEND_NUM_ARGS() == 1) {
RETURN_DOUBLE(log(num));
}
- if (base <= 0.0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0");
- RETURN_FALSE;
+
+#ifdef HAVE_LOG2
+ if (base == 2.0) {
+ RETURN_DOUBLE(log2(num));
}
- if (base == 1) {
+#endif
+
+ if (base == 10.0) {
+ RETURN_DOUBLE(log10(num));
+ }
+
+ if (base == 1.0) {
RETURN_DOUBLE(php_get_nan());
- } else {
- RETURN_DOUBLE(log(num) / log(base));
}
+
+ if (base <= 0.0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0");
+ RETURN_FALSE;
+ }
+
+ RETURN_DOUBLE(log(num) / log(base));
}
/* }}} */
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 60f8e465eb..5e9fa89cc8 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1137,6 +1137,22 @@ static void init_request_info(TSRMLS_D)
TRANSLATE_SLASHES(env_document_root);
}
+ if (!apache_was_here && env_path_translated != NULL && env_redirect_url != NULL &&
+ env_path_translated != script_path_translated &&
+ strcmp(env_path_translated, script_path_translated) != 0) {
+ /*
+ * pretty much apache specific. If we have a redirect_url
+ * then our script_filename and script_name point to the
+ * php executable
+ * we don't want to do this for the new mod_proxy_fcgi approach,
+ * where redirect_url may also exist but the below will break
+ * with rewrites to PATH_INFO, hence the !apache_was_here check
+ */
+ script_path_translated = env_path_translated;
+ /* we correct SCRIPT_NAME now in case we don't have PATH_INFO */
+ env_script_name = env_redirect_url;
+ }
+
#ifdef __riscos__
/* Convert path to unix format*/
__riscosify_control |= __RISCOSIFY_DONT_CHECK_DIR;
@@ -1314,6 +1330,18 @@ static void init_request_info(TSRMLS_D)
}
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", script_path_translated TSRMLS_CC);
}
+ if (!apache_was_here && env_redirect_url) {
+ /* if we used PATH_TRANSLATED to work around Apache mod_fastcgi (but not mod_proxy_fcgi,
+ * hence !apache_was_here) weirdness, strip info accordingly */
+ if (orig_path_info) {
+ _sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
+ }
+ if (orig_path_translated) {
+ _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC);
+ _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
+ }
+ }
if (env_script_name != orig_script_name) {
if (orig_script_name) {
_sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);