- Fixed bug #50255 (isset() and empty() silently casts array to object)

This commit is contained in:
Felipe Pena 2009-11-24 21:54:12 +00:00
parent 5c77b94e60
commit bb179ad150
4 changed files with 45 additions and 13 deletions

2
NEWS
View File

@ -29,6 +29,8 @@ PHP NEWS
- Fixed bug #50282 (xmlrpc_encode_request() changes object into array in
calling function). (Felipe)
- Fixed bug #50267 (get_browser(null) does not use HTTP_USER_AGENT). (Jani)
- Fixed bug #50255 (isset() and empty() silently casts array to object).
(Felipe)
- Fixed bug #50240 (pdo_mysql.default_socket in php.ini shouldn't used
if it is empty). (foutrelis at gmail dot com, Ilia)
- Fixed bug #50219 (soap call Segmentation fault on a redirected url).

30
Zend/tests/bug50255.phpt Normal file
View File

@ -0,0 +1,30 @@
--TEST--
Bug #50255 (isset() and empty() silently casts array to object)
--FILE--
<?php
$arr = array('foo' => 'bar');
print "isset\n";
var_dump(isset($arr->foo));
var_dump(isset($arr->bar));
var_dump(isset($arr['foo']));
var_dump(isset($arr['bar']));
print "empty\n";
var_dump(empty($arr->foo));
var_dump(empty($arr->bar));
var_dump(empty($arr['foo']));
var_dump(empty($arr['bar']));
?>
--EXPECT--
isset
bool(false)
bool(false)
bool(true)
bool(false)
empty
bool(true)
bool(true)
bool(false)
bool(true)

View File

@ -3915,7 +3915,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;

View File

@ -10806,7 +10806,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -12555,7 +12555,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -14355,7 +14355,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -16741,7 +16741,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -17931,7 +17931,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -18988,7 +18988,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -20045,7 +20045,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -21361,7 +21361,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -24347,7 +24347,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
zval *offset = &opline->op2.u.constant;
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -25987,7 +25987,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int
zend_free_op free_op2;
zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -27677,7 +27677,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int
zend_free_op free_op2;
zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;
@ -29854,7 +29854,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
if (Z_TYPE_PP(container) == IS_ARRAY) {
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) {
HashTable *ht;
int isset = 0;