wordpress - PHP Undefined index - only in development environment -
i'm not php dev - sorry noob question - i'm confused behaviour of php code given. works fine in production , uat environments, wrong handling of collections in development environment.
in wordpress project code gives error:
$contact_display_2 = $post_meta['contact_display_2'][0]; the error is: notice: undefined index: contact_number_2 in /www/wp-content/themes/custom/standard-content.php on line 85
i ok understanding there no such variable in $post_meta array , isset() function help solve particular error. question is: needs changed in environment configuration application work in development environment in same way in production? thanks
the usual work around when find code written badly amend php.ini file , turn off parameter
display_errors=off this stop errors beingness shown on browser, may still logged file, see error_log = "some file in folder"
a improve solution, if running wp project in apache virtual host turn parameter off within virtual hosts definition so
php_flag display_errors off this way improve turns parameter off 1 badly written site , not every site might developing/maintaining. stops writing code badly the developer wrote site stuck with.
php wordpress
No comments:
Post a Comment