Model Constructors
Hi all, I had a puzzling problem with the 1.2 pre-beta (rev 5875) when I deployed my site to a PHP 4 server (my local testing setup is PHP 5). The problem was a totally blank page - nothing was rendered, even at the highest debug level. The fix was adding an empty constructor to my models. Weirdly it works to add a PHP 5 style __construct() method (I'm guessing that has something to do with the implementation of Overloadable). Calling parent::__construct() brings back the blank screen, which is also odd. These were baked Model classes, and bake doesn't include a constructor, so I'm guessing this is a bug or a problem with my setup. I was wondering if anyone had a similar problem or might know the cause. The server is running PHP 4.4.7 and is also running Zend Optimizer which may be a problem, I gather. Thanks, -dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model Constructors
On Dec 1, 1:02 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I had a puzzling problem with the 1.2 pre-beta (rev 5875) when I deployed my site to a PHP 4 server (my local testing setup is PHP 5). The problem was a totally blank page - nothing was rendered, even at the highest debug level. The fix was adding an empty constructor to my models. Weirdly it works to add a PHP 5 style __construct() method (I'm guessing that has something to do with the implementation of Overloadable). Calling parent::__construct() brings back the blank screen, which is also odd. These were baked Model classes, and bake doesn't include a constructor, so I'm guessing this is a bug or a problem with my setup. I was wondering if anyone had a similar problem or might know the cause. The server is running PHP 4.4.7 and is also running Zend Optimizer which may be a problem, I gather. Thanks, -dave You don't need to add a constructor, and doing so is risky business. Particularly as adding one and not calling the parent (with the passed params, the model constructor has some parameters which you are removing) basically means you are disabling all of cake's model work and have about 0% chance of your models being of use. It's probably the zend optimizer problem, check the group for solutions (hint find the __ method), I'd bet it turns out to be missing/misnamed file/class/method. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model Constructors
You don't need to add a constructor, and doing so is risky business. Particularly as adding one and not calling the parent (with the passed params, the model constructor has some parameters which you are removing) basically means you are disabling all of cake's model work and have about 0% chance of your models being of use. Yes, I didn't think it would really *work*, I was just wondering why it allowed the page to display, and if it was some weird PHP 4/PHP 5 difference. It's probably the zend optimizer problem, check the group for solutions (hint find the __ method), I'd bet it turns out to be missing/misnamed file/class/method. It was the Zend Optimizer issue. I disabled __() since I'm not using it in the app, and the Cake error page displayed telling me it couldn't find my table. Turned out I had a space prepending the database name in database config. Doh! Once the error page actually displayed it was an easy fix. Since it seems to be causing a lot of problems, perhaps it may be a good idea for Cake to check for the existence of the Zend Optimizer, and issue a warning message? Just a thought. Blank output bugs are hard to troubleshoot. Thanks for the help. I believe the blank model constructor helped precisely because it disables any non-trivial model functionality. -dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---