paintBackend($o) not inheriting sanely with php 5?


(David Schoen) #1

I'm testing some of our custom assets on 3.18 so that we can start getting them working now, they don't do anything fancy just store some info about our org structure the way we want.


The one I'm working on at the moment is a person asset that inherits directly from page.



After fixing the constructor code to match 3.18 assets the asset installed without issue and was added to the menu. I can create one fine.



When I went to the details screen I would mostly get a blank white screen, at first I assumed this was a memory error with my fresh vm, after pumping all the mems up to 1024MB I decided I got something else wrong. (note: there were no errors arriving in error.log)



Eventually I found (after copying page_standard and deleting one thing I didn't need at a time) that if I have the paintBackend function on the asset it works fine, if I don't it doesn't. This wasn't needed with matrix 3.14/16 and php 4 so I'm just wondering if I've missunderstood something fundermental about the way php 5 does the inheritance thing.



If I add

    public function paintBackend(Backend_Outputter $o)
{
parent::paintBackend($o);
}
to the person asset it works, without it, it doesn't.



I checked where the parent function is coming from and it should be coming straight from Asset.inc as Page.inc doesn't define a paintBackend function. The definition in Asset.inc is also public.



Anyone have any comments?



Cheers,

Dave.

(Greg Sherwood) #2

Inheritance works in the same way; you shouldn't need a paintBackend method and we don't use it for most of our page templates. Take a look at Site Map for example, which doesn't include this method. Is that also broken for you?


(David Schoen) #3

Thanks for the fast reply.



No my Site map doesn't work… I might try reinstalling again, this is still the install I did with 5.2.5 earlier maybe something "special" got left behind.