#31714 [Opn]: exception suppression using @ doesnt work when php is installed asApache module
ID: 31714 User updated by: alexei at net24 dot co dot nz Reported By: alexei at net24 dot co dot nz Status: Open Bug Type: *Web Server problem Operating System: freebsd PHP Version: 5.0.3 New Comment: this can be desired behaviour Previous Comments: [2005-01-27 03:47:42] alexei at net24 dot co dot nz correction seems that it does not work when called via CLI either all it does is hiding fatal error message but does not suppress exception [2005-01-27 03:10:30] alexei at net24 dot co dot nz Description: When error suppression operator is used for the function where exception can be thrown it DOES suppress exception when script is called using CLI but DOES NOT do it when script is called from apache Reproduce code: --- Expected result: 12 Actual result: -- when called via CLI: 12 when called from apache: 1 there's also no fatal error displayed, script just silently dies -- Edit this bug report at http://bugs.php.net/?id=31714&edit=1
#31714 [Opn]: exception suppression using @ doesnt work when php is installed asApache module
ID: 31714 User updated by: alexei at net24 dot co dot nz Reported By: alexei at net24 dot co dot nz Status: Open Bug Type: *Web Server problem Operating System: freebsd PHP Version: 5.0.3 New Comment: correction seems that it does not work when called via CLI either all it does is hiding fatal error message but does not suppress exception Previous Comments: [2005-01-27 03:10:30] alexei at net24 dot co dot nz Description: When error suppression operator is used for the function where exception can be thrown it DOES suppress exception when script is called using CLI but DOES NOT do it when script is called from apache Reproduce code: --- Expected result: 12 Actual result: -- when called via CLI: 12 when called from apache: 1 there's also no fatal error displayed, script just silently dies -- Edit this bug report at http://bugs.php.net/?id=31714&edit=1
#31714 [NEW]: exception suppression using @ doesnt work when php is installed asApache module
From: alexei at net24 dot co dot nz Operating system: freebsd PHP version: 5.0.3 PHP Bug Type: *Web Server problem Bug description: exception suppression using @ doesnt work when php is installed asApache module Description: When error suppression operator is used for the function where exception can be thrown it DOES suppress exception when script is called using CLI but DOES NOT do it when script is called from apache Reproduce code: --- Expected result: 12 Actual result: -- when called via CLI: 12 when called from apache: 1 there's also no fatal error displayed, script just silently dies -- Edit bug report at http://bugs.php.net/?id=31714&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31714&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31714&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31714&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=31714&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=31714&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31714&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31714&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31714&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31714&r=support Expected behavior: http://bugs.php.net/fix.php?id=31714&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31714&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31714&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=31714&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31714&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=31714&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31714&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31714&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31714&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31714&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31714&r=mysqlcfg
#28444 [Com]: "Cannot access undefined property for object with overloaded property access"
ID: 28444 Comment by: alexei at net24 dot co dot nz Reported By: dennis at inmarket dot lviv dot ua Status: Analyzed Bug Type: Class/Object related Operating System: WinXP PHP Version: 5.0.0RC2 New Comment: another "workaround", it allows to use this feature now and to convert scripts later when this feature is available in php. class a { function __call ($property, $args){ return __get($property); } use it like this: $a->b->c=10; as $a->b()->c=10; echo $a->b->c; as echo $a->b()->c; Previous Comments: -------- [2004-08-05 06:48:18] alexei at net24 dot co dot nz it allows to read value referenced by $a->b->c but it does not allow to modify it, that's makes the whole thing inconsistent... workaround like below does the job, but it is ugly! $b=$a->b; $b->c=5; i think if ->-> is called it should call __get methods at all each stage and pass reference to the next -> operation [2004-06-30 04:21:46] ryan dot harris at gmail dot com A good solution would be to have a way of doing a "pre-set" routine i.e. __get($propertyname, $pre_set = true) and that routine is expected to return a valid object or the "Cannot access undefined..." will automatically result. Some more example code that causes the problem (no way of testing to see if the concept is correct - since this message keeps appearing): class Setting { private $mSettings; function __construct() { $constructor_args = func_get_args(); if (isset($constructor_args[0])) { $this->mSettings = array("_defaultValue"=>$constructor_args[0]); } else $this->mSettings = array("_defaultValue"=>null); } function __get($propertyName) { print "[$propertyName]\n"; if ($propertyName == "_settingCount") { return count($this->mSettings) - 1; } elseif ($propertyName == "_valueNames") { //return $this->GetValueNames(); } elseif ($propertyName == "_keyNames") { //return $this->GetValueNames(); } elseif ($propertyName == "_defaultValue") { print_r($this->mSettings); return $this->mSettings["_defaultValue"]; } // It's none of the special properties. if (isset($this->mSettings[$propertyName])) { return $this->mSettings[$propertyName]; } else { // If we had the $pre_set we could do this: if ($pre_set) { // initialize for a set $this->mSettings[$propertyName] = new Setting(); return $this->mSettings[$propertyName]; } else throw new Exception("Undefined setting name."); } } function __set($propertyName, $propertyValue) { print "[$propertyName]\n"; switch ($propertyName) { case "_settingCount": case "_valueNames": case "_keyNames": throw Exception("Property is read only."); break; case "_defaultValue": $this->mSettings["_defaultValue"] = $propertyValue; break; default: if (!isset($this->mSettings[$propertyName])) $this->mSettings[$propertyName] = new Setting($propertyValue); else $this->mSettings[$propertyName]->_defaultValue = $propertyValue; break; } // switch } } This code if it worked would let you do the following: $t = new Setting(); $t->includes->_defaultValue = "Automated" $t->includes->automatedIncludes->includeDirectory = "c:/includes" $t->includes->automatedIncludes = "oncePerFile" $t->includes->manualIncludes->includeDirectory = "c:/php" Which would represent: includes = Automated --> automatedIncludes = oncePerFile --> includeDirectory = c:/includes
#28444 [Com]: "Cannot access undefined property for object with overloaded property access"
ID: 28444 Comment by: alexei at net24 dot co dot nz Reported By: dennis at inmarket dot lviv dot ua Status: Analyzed Bug Type: Class/Object related Operating System: WinXP PHP Version: 5.0.0RC2 New Comment: it allows to read value referenced by $a->b->c but it does not allow to modify it, that's makes the whole thing inconsistent... workaround like below does the job, but it is ugly! $b=$a->b; $b->c=5; i think if ->-> is called it should call __get methods at all each stage and pass reference to the next -> operation Previous Comments: [2004-06-30 04:21:46] ryan dot harris at gmail dot com A good solution would be to have a way of doing a "pre-set" routine i.e. __get($propertyname, $pre_set = true) and that routine is expected to return a valid object or the "Cannot access undefined..." will automatically result. Some more example code that causes the problem (no way of testing to see if the concept is correct - since this message keeps appearing): class Setting { private $mSettings; function __construct() { $constructor_args = func_get_args(); if (isset($constructor_args[0])) { $this->mSettings = array("_defaultValue"=>$constructor_args[0]); } else $this->mSettings = array("_defaultValue"=>null); } function __get($propertyName) { print "[$propertyName]\n"; if ($propertyName == "_settingCount") { return count($this->mSettings) - 1; } elseif ($propertyName == "_valueNames") { //return $this->GetValueNames(); } elseif ($propertyName == "_keyNames") { //return $this->GetValueNames(); } elseif ($propertyName == "_defaultValue") { print_r($this->mSettings); return $this->mSettings["_defaultValue"]; } // It's none of the special properties. if (isset($this->mSettings[$propertyName])) { return $this->mSettings[$propertyName]; } else { // If we had the $pre_set we could do this: if ($pre_set) { // initialize for a set $this->mSettings[$propertyName] = new Setting(); return $this->mSettings[$propertyName]; } else throw new Exception("Undefined setting name."); } } function __set($propertyName, $propertyValue) { print "[$propertyName]\n"; switch ($propertyName) { case "_settingCount": case "_valueNames": case "_keyNames": throw Exception("Property is read only."); break; case "_defaultValue": $this->mSettings["_defaultValue"] = $propertyValue; break; default: if (!isset($this->mSettings[$propertyName])) $this->mSettings[$propertyName] = new Setting($propertyValue); else $this->mSettings[$propertyName]->_defaultValue = $propertyValue; break; } // switch } } This code if it worked would let you do the following: $t = new Setting(); $t->includes->_defaultValue = "Automated" $t->includes->automatedIncludes->includeDirectory = "c:/includes" $t->includes->automatedIncludes = "oncePerFile" $t->includes->manualIncludes->includeDirectory = "c:/php" Which would represent: includes = Automated --> automatedIncludes = oncePerFile --> includeDirectory = c:/includes --> manualIncludes --> includeDirectory = c:/php in a lightweight manner. The layers would be created as they are needed and all with an elegant method. [2004-06-14 20:24:14] cunha17 at uol dot com dot br This odd behavior is still present in latest CVS and happens in Linux also. Cristiano Duarte -