felipe Tue, 24 Nov 2009 21:54:12 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291282
Log:
- Fixed bug #50255 (isset() and empty() silently casts array to object)
Bug: http://bugs.php.net/50255 (Closed) isset() and empty() silently casts
array to object
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
A php/php-src/branches/PHP_5_2/Zend/tests/bug50255.phpt
U php/php-src/branches/PHP_5_2/Zend/zend_vm_def.h
U php/php-src/branches/PHP_5_2/Zend/zend_vm_execute.h
U php/php-src/branches/PHP_5_3/NEWS
A php/php-src/branches/PHP_5_3/Zend/tests/bug50255.phpt
U php/php-src/branches/PHP_5_3/Zend/zend_vm_def.h
U php/php-src/branches/PHP_5_3/Zend/zend_vm_execute.h
A php/php-src/trunk/Zend/tests/bug50255.phpt
U php/php-src/trunk/Zend/zend_vm_def.h
U php/php-src/trunk/Zend/zend_vm_execute.h
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_2/NEWS 2009-11-24 21:54:12 UTC (rev 291282)
@@ -12,6 +12,8 @@
- Fixed bug #50282 (xmlrpc_encode_request() changes object into array in
calling function). (Felipe)
+- Fixed bug #50255 (isset() and empty() silently casts array to object).
+ (Felipe)
- Fixed bug #50219 (soap call Segmentation fault on a redirected url).
(Pierrick)
- Fixed bug #50207 (segmentation fault when concatenating very large strings
Added: php/php-src/branches/PHP_5_2/Zend/tests/bug50255.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/bug50255.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/Zend/tests/bug50255.phpt 2009-11-24 21:54:12 UTC (rev 291282)
@@ -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)
Property changes on: php/php-src/branches/PHP_5_2/Zend/tests/bug50255.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_2/Zend/zend_vm_def.h
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_vm_def.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_2/Zend/zend_vm_def.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -3532,7 +3532,7 @@
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;
Modified: php/php-src/branches/PHP_5_2/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_vm_execute.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_2/Zend/zend_vm_execute.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -9750,7 +9750,7 @@
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;
@@ -11283,7 +11283,7 @@
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;
@@ -12864,7 +12864,7 @@
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;
@@ -14890,7 +14890,7 @@
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;
@@ -16009,7 +16009,7 @@
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;
@@ -17002,7 +17002,7 @@
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;
@@ -17995,7 +17995,7 @@
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;
@@ -19256,7 +19256,7 @@
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;
@@ -22018,7 +22018,7 @@
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;
@@ -23543,7 +23543,7 @@
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;
@@ -25115,7 +25115,7 @@
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;
@@ -27131,7 +27131,7 @@
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;
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-11-24 21:54:12 UTC (rev 291282)
@@ -29,6 +29,8 @@
- 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).
Added: php/php-src/branches/PHP_5_3/Zend/tests/bug50255.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug50255.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug50255.phpt 2009-11-24 21:54:12 UTC (rev 291282)
@@ -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)
Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug50255.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_3/Zend/zend_vm_def.h
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_vm_def.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_3/Zend/zend_vm_def.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -3915,7 +3915,7 @@
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;
Modified: php/php-src/branches/PHP_5_3/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_vm_execute.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/branches/PHP_5_3/Zend/zend_vm_execute.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -10806,7 +10806,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
Added: php/php-src/trunk/Zend/tests/bug50255.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug50255.phpt (rev 0)
+++ php/php-src/trunk/Zend/tests/bug50255.phpt 2009-11-24 21:54:12 UTC (rev 291282)
@@ -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)
Property changes on: php/php-src/trunk/Zend/tests/bug50255.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/trunk/Zend/zend_vm_def.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -4095,7 +4095,7 @@
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;
Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h 2009-11-24 20:10:19 UTC (rev 291281)
+++ php/php-src/trunk/Zend/zend_vm_execute.h 2009-11-24 21:54:12 UTC (rev 291282)
@@ -11279,7 +11279,7 @@
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;
@@ -13097,7 +13097,7 @@
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;
@@ -14966,7 +14966,7 @@
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;
@@ -17428,7 +17428,7 @@
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;
@@ -18684,7 +18684,7 @@
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;
@@ -19799,7 +19799,7 @@
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;
@@ -20914,7 +20914,7 @@
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;
@@ -22287,7 +22287,7 @@
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;
@@ -25482,7 +25482,7 @@
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;
@@ -27188,7 +27188,7 @@
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;
@@ -28944,7 +28944,7 @@
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;
@@ -31191,7 +31191,7 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php