mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
parent
1205a6c7dc
commit
dc4bf922d9
2
NEWS
2
NEWS
@ -67,6 +67,8 @@ PHP NEWS
|
||||
1.1). (Adam)
|
||||
. Implemented Change crypt() behavior w/o salt RFC. (Yasuo)
|
||||
https://wiki.php.net/rfc/crypt_function_salt
|
||||
. Implemented request #49824 (Change array_fill() to allow creating empty
|
||||
array). (Nikita)
|
||||
|
||||
- XMLReader:
|
||||
. Fixed bug #55285 (XMLReader::getAttribute/No/Ns methods inconsistency).
|
||||
|
@ -1521,14 +1521,18 @@ PHP_FUNCTION(array_fill)
|
||||
return;
|
||||
}
|
||||
|
||||
if (num < 1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of elements must be positive");
|
||||
if (num < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of elements can't be negative");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* allocate an array for return */
|
||||
array_init_size(return_value, num);
|
||||
|
||||
if (num == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
num--;
|
||||
zend_hash_index_update(Z_ARRVAL_P(return_value), start_key, &val, sizeof(zval *), NULL);
|
||||
zval_add_ref(&val);
|
||||
|
@ -23,34 +23,28 @@ echo '== Done ==';
|
||||
--EXPECTF--
|
||||
===========================
|
||||
start: 0 num: 0 value: 1
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 0 value: d
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 0 value: e
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 0 value: f
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 0 num: 1 value: 1
|
||||
array(1) {
|
||||
@ -137,34 +131,28 @@ array(2) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value: 1
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value: d
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value: e
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 0 value: f
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 1 num: 1 value: 1
|
||||
array(1) {
|
||||
@ -251,34 +239,28 @@ array(2) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value: 1
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value:
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value: d
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value: e
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 0 value: f
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
===========================
|
||||
start: 2.5 num: 1 value: 1
|
||||
array(1) {
|
||||
|
@ -32,10 +32,6 @@ var_dump( array_fill($start_key,$num) );
|
||||
$num = -1;
|
||||
var_dump( array_fill($start_key,$num,$val) );
|
||||
|
||||
//callin array_fill with 'num' equal to zero value
|
||||
$num = 0;
|
||||
var_dump( array_fill($start_key,$num,$val) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
@ -53,9 +49,6 @@ NULL
|
||||
Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
Warning: array_fill(): Number of elements can't be negative in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
|
@ -106,7 +106,7 @@ array(2) {
|
||||
}
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
Warning: array_fill(): Number of elements can't be negative in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
array(5) {
|
||||
@ -122,13 +122,11 @@ array(5) {
|
||||
int(100)
|
||||
}
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d
|
||||
@ -150,31 +148,27 @@ NULL
|
||||
Warning: array_fill() expects parameter 2 to be long, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 13 --
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(100)
|
||||
}
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 15 --
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(100)
|
||||
}
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: array_fill() expects parameter 2 to be long, string given in %s on line %d
|
||||
@ -196,11 +190,9 @@ NULL
|
||||
Warning: array_fill() expects parameter 2 to be long, object given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: array_fill(): Number of elements must be positive in %s on line %d
|
||||
bool(false)
|
||||
array(0) {
|
||||
}
|
||||
Done
|
||||
|
Loading…
Reference in New Issue
Block a user