Until this morning, I was having major issues with the c:out tag
returning completely random values if the same property was resolved
several times (sometimes leading to an infinite loop). If I had a
scoped variable instance named 'car' of the standard class Car, the
following would blow up:
<c:out value="${car.make}"/>
<c:out value="${car.make}"/>
<c:out value="${car.make}"/>
...gradually the 'car' object would degrade until it was returning
complete crap. One would expect to see the same output in each
instance. As it turns out, it was all due to a reference error in the
PageContext class. Reference errors in PHP will kill you! I have had
it happen to me before.
I had the following code in PageContext that is used by c:out
function &getAttribute($property, $scope = 'page')
{
switch ($scope)
{
case 'page':
return isset($this->attributes[$property]) ?
$this->attributes[$property] : null;
case 'request'
...
}
}
The reason this is a bug is because the posix conditional will NOT
allow a reference to be returned...and we NEED a reference here or
else it starts copying objects and that is just a VERY bad thing in
our case. The proper syntax would be to create an if...else
statement.
I bring this up because it is a huge GOTCHA that you must be aware of
in PHP less you run into the same problems as myself. For now, it
looks like the bugs in the PSP parser are now solved and all tags
should work as expected.
Dan
--
Open Source Advocacy
http://www.mojavelinux.com
|