diff options
| author | Ondřej Surý <ondrej@sury.org> | 2014-08-14 16:47:40 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2014-08-14 16:47:40 +0200 |
| commit | dee9227b6f6c89113e8964649afaf57c2ebf1027 (patch) | |
| tree | 72a2baeb28b2057b89e189a46fb488dec487223c /ext/standard | |
| parent | b60f6e95a473d1ae97fdf20cec4cfefc06b24ec2 (diff) | |
| download | php-dee9227b6f6c89113e8964649afaf57c2ebf1027.tar.gz | |
New upstream version 5.6.0~rc4+dfsgupstream/5.6.0_rc4+dfsg
Diffstat (limited to 'ext/standard')
| -rw-r--r-- | ext/standard/array.c | 8 | ||||
| -rw-r--r-- | ext/standard/info.c | 8 | ||||
| -rw-r--r-- | ext/standard/tests/array/bug67064.phpt | 17 | ||||
| -rw-r--r-- | ext/standard/tests/array/bug67693.phpt | 25 |
4 files changed, 35 insertions, 23 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index cbcaaf5b8..f4806593c 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -333,16 +333,12 @@ PHP_FUNCTION(count) #ifdef HAVE_SPL /* if not and the object implements Countable we call its count() method */ if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { - zval *mode_zv; - MAKE_STD_ZVAL(mode_zv); - ZVAL_LONG(mode_zv, mode); - zend_call_method_with_1_params(&array, NULL, NULL, "count", &retval, mode_zv); + zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); if (retval) { convert_to_long_ex(&retval); RETVAL_LONG(Z_LVAL_P(retval)); zval_ptr_dtor(&retval); } - zval_ptr_dtor(&mode_zv); return; } #endif @@ -1893,7 +1889,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) /* If we did a shift... re-index like it did before */ if (!off_the_end) { zend_hash_reindex(Z_ARRVAL_P(stack), 1); - } else if (!key_len && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) { + } else if (!key_len && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) { Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; } diff --git a/ext/standard/info.c b/ext/standard/info.c index 1b1b8f202..343244c21 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -592,6 +592,14 @@ PHPAPI char *php_get_uname(char mode) php_get_windows_cpu(wincpu, sizeof(wincpu)); dwBuild = (DWORD)(HIWORD(dwVersion)); + + /* Windows "version" 6.2 could be Windows 8/Windows Server 2012, but also Windows 8.1/Windows Server 2012 R2 */ + if (dwWindowsMajorVersion == 6 && dwWindowsMinorVersion == 2) { + if (strncmp(winver, "Windows 8.1", 11) == 0 || strncmp(winver, "Windows Server 2012 R2", 22) == 0) { + dwWindowsMinorVersion = 3; + } + } + snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s", "Windows NT", ComputerName, dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu); diff --git a/ext/standard/tests/array/bug67064.phpt b/ext/standard/tests/array/bug67064.phpt deleted file mode 100644 index 2818516da..000000000 --- a/ext/standard/tests/array/bug67064.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #67064 (Countable interface prevents using 2nd parameter ($mode) of count() function) ---FILE-- -<?php -class Counter implements Countable { - public function count($mode = COUNT_NORMAL) { - var_dump($mode == COUNT_RECURSIVE); - return 1; - } -} - -$counter = new Counter; -var_dump(count($counter, COUNT_RECURSIVE)); -?> ---EXPECTF-- -bool(true) -int(1) diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt new file mode 100644 index 000000000..516436c51 --- /dev/null +++ b/ext/standard/tests/array/bug67693.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #67693 - incorrect push to empty array +--FILE-- +<?php + +$array = array(-1 => 0); + +array_pop($array); + +array_push($array, 0); +array_push($array, 0); + +var_dump($array); + +echo"\nDone"; +?> +--EXPECT-- +array(2) { + [0]=> + int(0) + [1]=> + int(0) +} + +Done |
