Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just upgraded to dev box to OSX Lion which has php 5.3.6 (from Snow Leopard).

Now my Yii made sites are broken. How do I know what code is now broken with out finding them out one by one? Why is the code below broken? Is there something that I can turn on in the php.ini files to overcome these things? I need to get back to work but don't want to just go back to Snow Leopard to do so. Would appreciate help / guidance.

Here are some of the following errors:

Use of undefined constant style - assumed 'style' on

'htmlOptions'=>array(style=>'cursor: pointer;'),

Fixed by enclosing 'style'

'htmlOptions'=>array('style'=>'cursor: pointer;'),

Trying to get property of non-object (Within CJuiTabs) on

'Title' =>$this->renderPartial("_details", array('model' => $model), $this),

Not sure how to fix this one

Use of undefined constant Y - assumed 'Y' (Within CGridView dataprovider) on

$dataProvider = 
    new CActiveDataProvider('Bus', array(
          'criteria'=>array(
               'with' => array(
                  'address' => array(
                        'on'=>'busAddresses.Id='.$model->Id.' 
                               AND busAddresses.IsPhysical="'.Y.'"',

Not sure how to fix this one

share|improve this question

migrated from stackoverflow.com Aug 26 '11 at 7:37

This question came from our site for professional and enthusiast programmers.

    
Broken how? The behavior leading to these messages is the same in PHP 5.3.6 as it was in whatever version of PHP Snow Leopard had (I know it was in the 5.3 series). In particular, all three are notices, not errors. The undefined constant ones at least are harmless (though they should still be fixed), and wouldn't by themselves be causing the site to be "broken". (Unless, of course, display_errors is on and the notice output is preventing headers from being sent). –  John Flatness Aug 25 '11 at 3:18
    
@John Flatness, I thought SL was in 5.3 also and was just trying to look that up. These errors or notices are blocking the page from being rendered but they were not before the upgrade. I compared the php.ini files but could not find the difference there to cause this. I did not have problems going from Leopard (PHP 5.2 I though) to Snow but now I am experiencing these problems with this upgrade. –  enfield Aug 25 '11 at 3:24
    
@John Flatness, I checked the display_errors value in this build and it is set to off. –  enfield Aug 25 '11 at 3:32
    
The thing is, if display_errors is set to off, you wouldn't see these messages you've posted, unless you're reading them out of a log. –  John Flatness Aug 25 '11 at 3:38
add comment

2 Answers

up vote 1 down vote accepted

Since you've implied elsewhere that you're getting more error messages than the few you posted, I'm going to assume that one of the errors you didn't post was something like this:

Warning: Cannot modify header information - headers already sent

Since the underlying causes of all these messages you're seeing isn't any different under your new version of PHP, a configuration setting is likely to blame for the difference. In particular, the display_errors setting, which simply controls whether the messages about all the errors, warnings and notices will be printed to the screen.

Apple's default php.ini file sets display_errors to Off, but you need to move the /etc/php.ini.default to /etc/php.ini to have that file take any effect. /etc/php.ini isn't carried over in an OS X upgrade, so it would make sense that you lost this setting.

share|improve this answer
    
thanks for the feedback. I have not seen that Warning yet, but then again I can not navigate through most of my site right now with what is going on. I commented above about the display_errors. It comes set to off. –  enfield Aug 25 '11 at 3:35
    
I did sudo cp /etc/php.ini.default /etc/php.ini after the upgrade too so it is using this file –  enfield Aug 25 '11 at 3:37
    
OK did some more digging. I change error_reporting = E_ALL & ~E_DEPRECATED to error_reporting = E_ALL & ~E_NOTICE and this was what was doing it. Guess the good thing that came of this was it brought some coding changes that should be done to my attention. –  enfield Aug 25 '11 at 3:54
1  
As a rule it's a good idea to have E_ALL (or even E_STRICT) on your dev environment and have errors turned off on your production environment. (I'm not sure how some of that code wasn't breaking stuff b4.) –  ldg Aug 25 '11 at 6:14
add comment
 AND busAddresses.IsPhysical="'.Y.'"',

Y is a string in your case, so use it as a string:

 AND busAddresses.IsPhysical="Y"',
share|improve this answer
    
Making that change within the code posted in the question does not work. Thanks for the answer though. –  enfield Aug 25 '11 at 3:18
    
@enfield: "doesn't work" explains nothing. Do you still have the same error message? –  zerkms Aug 25 '11 at 3:23
    
Scratch my comment. I thought the same error was appearing but I had another instance below on that same file that was causing the same error. Thanks for the help. –  enfield Aug 25 '11 at 3:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.