treated as integers unconditionally.
Standard:
+ . Undefined variables passed to compact() will now be reported as a notice.
. getimagesize() and related functions now report the mime type of BMP images
as image/bmp instead of image/x-ms-bmp, since the former has been registered
with the IANA (see RFC 7903).
ZVAL_DEREF(value_ptr);
ZVAL_COPY(&data, value_ptr);
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
- }
- if (zend_string_equals_literal(Z_STR_P(entry), "this")) {
+ } else if (zend_string_equals_literal(Z_STR_P(entry), "this")) {
zend_object *object = zend_get_this_object(EG(current_execute_data));
if (object) {
GC_ADDREF(object);
ZVAL_OBJ(&data, object);
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
}
+ } else {
+ php_error_docref(NULL, E_NOTICE, "Undefined variable: %s", ZSTR_VAL(Z_STR_P(entry)));
}
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
if (Z_REFCOUNTED_P(entry)) {
}
$result = compact('willNeverBeDefined');
var_dump($result, empty($result), $result === array(), empty($willNeverBeDefined));
---EXPECT--
+?>
+--EXPECTF--
+Notice: compact(): Undefined variable: willNeverBeDefined in %s on line %d
array(0) {
}
bool(true)
$result = compact("event", $location_vars);
var_dump($result);
?>
---EXPECT--
+--EXPECTF--
+Notice: compact(): Undefined variable: c\u0327ity in %s on line %d
array(2) {
["event"]=>
string(8) "SIGGRAPH"
--TEST--
-Test compact() function : basic functionality
+Test compact() function : basic functionality
--FILE--
<?php
/* Prototype : proto array compact(mixed var_names [, mixed ...])
- * Description: Creates a hash containing variables and their values
+ * Description: Creates a hash containing variables and their values
* Source code: ext/standard/array.c
- * Alias to functions:
+ * Alias to functions:
*/
/*
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing compact() : basic functionality ***
array(6) {
["a"]=>
}
array(0) {
}
+
+Notice: compact(): Undefined variable: g in %s on line %d
array(0) {
}
-Done
\ No newline at end of file
+Done
?>
==Done==
---EXPECT--
+--EXPECTF--
*** Testing compact() : usage variations - variables outside of current scope ***
+
+Notice: compact(): Undefined variable: a in %s on line %d
array(2) {
["b"]=>
string(3) "f.b"
["c"]=>
string(3) "f.c"
}
+
+Notice: compact(): Undefined variable: a in %s on line %d
array(2) {
["b"]=>
string(3) "f.b"
["c"]=>
string(3) "f.c"
}
-==Done==
\ No newline at end of file
+==Done==