By tejasdarji
Hello Support Team,
I have got this error after upgrade my php version from 5.3.10 to 5.5.7. My application is running in drupal 7.23 in ubuntu 12.04.
Error : Strict warning: Only variables should be passed by reference in include() (line 26 of /var/www/avcdistributor.com/sites/all/themes/tejas/templates/page.tpl.php).
Line 24-28 Says :
if($user->uid != 0){ $block = block_load(‘block’, ‘7’); $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); print $output; }
Can you please help me what is the issue, it will perfectly worked on php 5.3.10, but after upgrade php version it will not working.
Thanks, Tejas
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
it was perfectly worked on php 5.3.10, but after upgrade php version it will not working. <br> <br>The reason you are seeing this message after upgrading, is that strict warnings (E_STRICT) became part of E_ALL in 5.4.0. The default value for
error_reportingin 5.5.7 excludes E_STRICT, however if you didn’t alter your php.ini file, you will still have the 5.3 default which doesn’t exclude E_STRICT: <br> <br> 5.3: # Default Value: E_ALL & ~E_NOTICE <br> <br> 5.5: # Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED <br> <br>The correct action to resolve this is to add& ~E_STRICTto your existing error_reporting value in php.ini. <br> <br>http://php.net/manual/en/function.error-reporting.php#refsect1-function.error-reporting-changelog
the problem you are having is that you are passing the return of the function call “_block_get_renderable_array” to drupal_render. drupal_render expects that parameter to be passed by reference. You can only pass a variable by reference NOT the return value of a function call.
Here is an example fix. <pre> $block = block_load(‘block’, ‘7’); $render_block = _block_get_renderable_array(_block_render_blocks(array($block))) $output = drupal_render($render_block); print $output; </pre>
For more information on resolving this issue with your code, please refer to: http://www.php.net/manual/en/language.references.pass.php <br> <br>[Not recommended] <br>However, to prevent this warnings from displaying, add “~E_STRICT” to your php.ini on the error_reporting line. Such as: <br>error_reporting = E_ALL ~E_STRICT
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.