The Analyzer loads the theme preview in debug mode, so any errors can be displayed.
Please post the entire error message, especially the file and line number, so that you can better determine the source of the error.
I may be able to help you find the source of the error, but this would be a question for the developer of the theme you are analyzing.
Thread Starter
T0M75
(@t0m75)
My questions are:
Is there any reason why variables should be passed by reference?
What are the considerations to insist it?
I do not want to find the source of error i know where it is. I want to know, if there is any good reason why the developer of current plugin might make such assumption? Is there any security considerations involved or might it cause other future errors?
The theme i am using is Hueman and the developer has instructions how to create child theme, but why can’t I use Child Theme Configurator. I am interested of reasons behind the problem nothing else in fear of future. When i choose to use named theme.
Full error message:
Notice: Only variables should be passed by reference in hueman/option-tree/ot-loader.php on line 98
Notice: Only variables should be passed by reference in hueman/option-tree/ot-loader.php on line 326
The error is not saying that variables should be passed by reference, it is saying that only variables should be passed by reference.
For questions like these it is always a good idea to check the PHP documentation: http://php.net/manual/en/language.references.pass.php
In this case it is probably a developer not checking his or her code with a debugger. This error sometimes occurs when a core function, such as empty(), is given an expression as an argument instead of a variable.
Hope this helps.
I just checked the php source for the Hueman theme and as I guessed, an expression is being passed to a core function (in this case, explode()).
Instead of resolving the issue, the developer has decided to silence the notice by using the @ modifier. See below:
ot-loader.php at line 91:
if ( apply_filters( 'ot_child_theme_mode', false ) == true ) {
$path = ltrim( end( @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
} else {
$path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
}
… and again at line 321:
if ( true == OT_CHILD_THEME_MODE ) {
$path = ltrim( end( @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) );
define( 'OT_URL', trailingslashit( trailingslashit( get_stylesheet_directory_uri() ) . $path ) );
} else {
$path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) );
define( 'OT_URL', trailingslashit( trailingslashit( get_template_directory_uri() ) . $path ) );
}
Thread Starter
T0M75
(@t0m75)
Thanks a lot! Can you guess if there might be any drawbacks by doing so?
One of the goals of CTC is to help users vet themes prior to using them. The errors and notices come from PHP, not the plugin. They are provided via the analyzer for information to identify issues that might crash a site before the theme is activated.
ww.wp.xz.cn requires themes and plugins that are hosted ont he repository to be free of PHP errors and notices prior to publishing. However, changes in the WordPress core or PHP version sometimes cause code to develop issues where they had not existed before.
In my production site, these notices disappeared when I upgraded to Hueman 3.2.8.
I’m using PHP 7.0.6, WordPress 4.6.1, and a child theme of my own design.