Re: Patch for DataObject's class generator
| From: | Alan Richmond | Date: | Mon, 20 Dec 2004 18:10:11 +0000 |
| Subject: | Re: Patch for DataObject's class generator | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35184@lists.php.net to get a copy of this message | ||
On Monday 20 December 2004 05:34, Torsten Roehr wrote:
> my DO class generator patch has been only for a few days now (see links
> below). Are there any more comments? Alan?
I just wanted to say I think this is a great addition it allows the easy use
of getters and setters when overload isn't available. I recently used a bug
fixed version of Lukas' MDB2_DataObject port on a project and made heavy use
of overloading for getters and setters. My client's web host took the PHP
4.3.10 security warnings to heart, promptly upgraded and the overload bug [1]
killed the app. I was able to add these changes, regenerate the DOs and get
the site up again with minimal fuss.
Bug Fix for Patch
=================
_generateGetters() and _generateSetters() stristr results in false positives
in a couple of cases:
1) When user methods use auto/overloaded getters/setters.
2) When auto/overloaded getter/setter names are a substring of a user method
name.
function getClosedateUs()
^^^^^^^^^^^^false match
{
return $this->_dateIsoToUs($this->getClosedate());
^^^^^^^^^^^^false match
}
Fix
===
Just make the search a little more discriminating:
stristr($input, "function $methodName(")
-Alan
[1] http://bugs.php.net/bug.php?id=31106
--
Alan Richmond
Aardwolf Web
http://www.aardwolfweb.com