From: cataphract
Operating system: Irrelevant
PHP version: trunk-SVN-2010-09-18 (SVN)
Package: Scripting Engine problem
Bug Type: Feature/Change Request
Bug description:Refactor big if condition w/ collateral effects and nested
ternary statements
Description:
------------
Two if conditions (one in zend_std_read_property and another in
zend_std_write_property) are very confusing and should be refactored.
Here's one:
493 if (EXPECTED(property_info != NULL) &&
494 ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
495 property_info->offset >= 0) ?
496 (zobj->properties ?
497 ((variable_ptr =
(zval**)zobj->properties_table[property_info->offset]) != NULL) :
498 (*(variable_ptr =
&zobj->properties_table[property_info->offset]) != NULL)) :
499 (EXPECTED(zobj->properties != NULL) &&
500 EXPECTED(zend_hash_quick_find(zobj->properties,
property_info->name, property_info->name_length+1, property_info->h, (void
**) &variable_ptr) == SUCCESS)))) {
501 /* if we already have this value there, we don't
actually need to
do anything */
This is very non-obvious.
I've refactored the conditions, which I tested with no regressions in the
tests.
--
Edit bug report at http://bugs.php.net/bug.php?id=52874&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52874&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52874&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52874&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52874&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52874&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52874&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52874&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52874&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52874&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52874&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52874&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52874&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52874&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52874&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52874&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52874&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52874&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52874&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52874&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52874&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52874&r=mysqlcfg