Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi for PHP/Library    [ Add a report in this area ]  
Report #:  111857   Status: Need Feedback
Serious RPCL bug with methods beginning with "set" or "get"
Project:  HTML5 Builder Build #:  5.1.167.137
Version:    5.0 Submitted By:   Michael Ainsworth
Report Type:  Crash / Data loss / Total failure Date Reported:  1/10/2013 4:46:07 PM
Severity:    Infrequently encountered problem Last Updated: 1/10/2013 6:45:00 PM
Platform:    All platforms Internal Tracking #:  
Resolution: Need More Info (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
RPCL does not allow classes derived from forms to include methods beginning with "get" or "set", as this triggers the magic methods for getting and setting properties.

This bug manifested itself in the php "call to undefined method" error message. I've spent at least 2 hours trying to resolve this error, using all the usual tricks - restarting the browser, restarting the IDE, deleting the contents of "C:\Users\<USERNAME\AppData\Local\Temp" including session data, deleting all "__history" files and temporary files beginning with "~".

I've never before used a library that will *** crash *** if you use certain characters in your function names (even very strongly focused "convention over configuration" libraries), an issue that as far as I can tell is *** completely undocumented ***.

The error message is below. Note that the function I'd written was "setAnimalsKeyFromPostData()" (note the "set", not "get", in the function name) but the error message mentioned "getAnimalsKeyFromPostData()" (note here "get", not "set").

?Fatal error: Call to undefined method frmmembershipinventoryanimals::getAnimalsKeyFromPostData() in C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\classes.inc.php on line 1164 Fatal error: Uncaught exception 'EPropertyNotFound' with message 'Trying to access non-existant property frmmembershipinventoryanimals->AnimalsKeyFromPostData in classes.inc.php, line 1025.' in C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\system.inc.php:307 Stack trace: #0 C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\classes.inc.php(1025): Object->__get('AnimalsKeyFromP...') #1 C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\forms.inc.php(277): Persistent->serialize() #2 C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\classes.inc.php(1876): CustomPage->serialize() #3 C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\forms.inc.php(53): Component->serializeChildren() #4 [internal function]: RPCLShutdown() #5 {main} thrown in C:\Program Files (x86)\Embarcadero\HTML5 Builder\5.0\rpcl\system.inc.php on line 307
Steps to Reproduce:
To reproduce this error,
create a blank form
write a method beginning with "set".
In the form's "onCreate" method, call this new "set" method.
Workarounds
Two workarounds that I can see.

1. Do not write any methods that start with "get" or "set".
2. Fix the code manually. E.g., edit RPCL's library to use the PHP "ReflectionClass" class to determine whether or not to call the function, or whether to use magic getters and setters.
Attachment
None
Comments

Tomohiro Takahashi at 1/10/2013 6:45:13 PM -
Could you please attach sample project to verify your issue?

Server Response from: ETNACODE01