#40248 [Opn]: Undefined members with combined operators produce no warning

2007-08-21 Thread vrana
 ID:   40248
 Updated by:   [EMAIL PROTECTED]
 Reported By:  jontsa at amigaone dot cc
 Status:   Open
-Bug Type: Documentation problem
+Bug Type: Class/Object related
 Operating System: Solaris
 PHP Version:  5.2.0
 New Comment:

I gave two reasons why this is a bug:

1. Consistency
1a. $b->a += 5 should be semantic equivalent to $b->a = $b->a + 5.
Later produces notice, former not.
1b. Both $a += 5 and $a = $a + 5 produces notice (same for arrays).
Object properties miss one notice.

2. Error-prone
The notice is here to inform the programmer about working with
undefined variable/property/index. Adding a value to a property is
clearly a usage of the property.

Jani gave one reason (operator precedence) which is erroneous because
$b->a alone issues the notice too.

Discussed on internals: http://news.php.net/php.internals/31732

Before bogusing this report again please provide some real arguments on
[EMAIL PROTECTED]


Previous Comments:


[2007-08-19 20:12:24] [EMAIL PROTECTED]

*sigh*

If you don't want to document it, let someone else document it. This is
_NOT_ any bug.



[2007-08-18 08:26:19] [EMAIL PROTECTED]

a; // Notice
$b->c = $b->c + 5; // Notice
$b->a += 5;
?>

It really is not a rocket science. This behavior is inconsistent and
errors-hiding. The explanation through operator precedence doesn't work
as $b->a alone issues the notice too.

If you don't want to fix it then leave it to others.



[2007-08-17 23:34:16] [EMAIL PROTECTED]

Operator precedence. $b->a happens before += and thus the property does
exist before assignment. Not really rocket science. Now go document it.



[2007-08-17 16:05:48] [EMAIL PROTECTED]

If this incostitent and possibly-errors-hiding behavior should be
documented as a feature it should be explained why PHP behaves this
way.

Please write down the reasons why this is the correct behavior. I
provided two reasons why this is more bug than a feature.



[2007-08-17 13:37:23] [EMAIL PROTECTED]

Because it is.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40248

-- 
Edit this bug report at http://bugs.php.net/?id=40248&edit=1


#40248 [Opn]: Undefined members with combined operators produce no warning

2007-08-18 Thread vrana
 ID:   40248
 Updated by:   [EMAIL PROTECTED]
 Reported By:  jontsa at amigaone dot cc
 Status:   Open
-Bug Type: Documentation problem
+Bug Type: Class/Object related
 Operating System: Solaris
 PHP Version:  5.2.0
 New Comment:

a; // Notice
$b->c = $b->c + 5; // Notice
$b->a += 5;
?>

It really is not a rocket science. This behavior is inconsistent and
errors-hiding. The explanation through operator precedence doesn't work
as $b->a alone issues the notice too.

If you don't want to fix it then leave it to others.


Previous Comments:


[2007-08-17 23:34:16] [EMAIL PROTECTED]

Operator precedence. $b->a happens before += and thus the property does
exist before assignment. Not really rocket science. Now go document it.



[2007-08-17 16:05:48] [EMAIL PROTECTED]

If this incostitent and possibly-errors-hiding behavior should be
documented as a feature it should be explained why PHP behaves this
way.

Please write down the reasons why this is the correct behavior. I
provided two reasons why this is more bug than a feature.



[2007-08-17 13:37:23] [EMAIL PROTECTED]

Because it is.



[2007-08-17 11:09:21] [EMAIL PROTECTED]

Why this form of usage of undefined property should be considered as
feature?



[2007-05-10 20:40:29] [EMAIL PROTECTED]

This is actually a feature. Can't seem to find where it's documented
though so reclassifying.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40248

-- 
Edit this bug report at http://bugs.php.net/?id=40248&edit=1


#40248 [Opn]: Undefined members with combined operators produce no warning

2007-08-17 Thread vrana
 ID:   40248
 Updated by:   [EMAIL PROTECTED]
 Reported By:  jontsa at amigaone dot cc
 Status:   Open
-Bug Type: Documentation problem
+Bug Type: Class/Object related
 Operating System: Solaris
 PHP Version:  5.2.0
 New Comment:

If this incostitent and possibly-errors-hiding behavior should be
documented as a feature it should be explained why PHP behaves this
way.

Please write down the reasons why this is the correct behavior. I
provided two reasons why this is more bug than a feature.


Previous Comments:


[2007-08-17 13:37:23] [EMAIL PROTECTED]

Because it is.



[2007-08-17 11:09:21] [EMAIL PROTECTED]

Why this form of usage of undefined property should be considered as
feature?



[2007-05-10 20:40:29] [EMAIL PROTECTED]

This is actually a feature. Can't seem to find where it's documented
though so reclassifying.



[2007-01-26 10:12:51] jontsa at amigaone dot cc

Description:

When using a combined operator like += or ++ on an undefined class
member, it does not produce "undefined property" notice as expected.
Tested with all errors enabled.

Reproduce code:
---
$a+=5;
$b=new stdClass;
$b->a+=5;


Expected result:

Notice: Undefined variable: a
Notice: Undefined property: stdClass::$a

Actual result:
--
Notice: Undefined variable: a





-- 
Edit this bug report at http://bugs.php.net/?id=40248&edit=1


#40248 [Opn]: Undefined members with combined operators produce no warning

2007-08-17 Thread vrana
 ID:   40248
 Updated by:   [EMAIL PROTECTED]
 Reported By:  jontsa at amigaone dot cc
 Status:   Open
-Bug Type: Documentation problem
+Bug Type: Class/Object related
 Operating System: Solaris
 PHP Version:  5.2.0
 New Comment:

Why this form of usage of undefined property should be considered as
feature?


Previous Comments:


[2007-05-10 20:40:29] [EMAIL PROTECTED]

This is actually a feature. Can't seem to find where it's documented
though so reclassifying.



[2007-01-26 10:12:51] jontsa at amigaone dot cc

Description:

When using a combined operator like += or ++ on an undefined class
member, it does not produce "undefined property" notice as expected.
Tested with all errors enabled.

Reproduce code:
---
$a+=5;
$b=new stdClass;
$b->a+=5;


Expected result:

Notice: Undefined variable: a
Notice: Undefined property: stdClass::$a

Actual result:
--
Notice: Undefined variable: a





-- 
Edit this bug report at http://bugs.php.net/?id=40248&edit=1