The latest SVN tag is 2.5
, but the latest published version on www.ads-software.com is 2.4.9
. This is causing a downstream issue when installing with Composer. composer update
pulls from WPackagist.org, which is reporting that this plugin is at version 2.5
because of the SVN tag. See the reported issue and required resolution at https://github.com/outlandishideas/wpackagist/issues/515
Could you please either remove the incorrect SVN tag or publish the plugin to version 2.5
. Thanks.
Hi,
Your plugin produces the following PHP notice on any page where wp_query->post
is undefined:
Notice: Trying to get property ‘ID’ of non-object in /wp-content/plugins/skyword-wordpress-plugin/php/class-skyword-opengraph.php on line 32
It would be great if you could fix this in a future update.
Thanks,
Brett
There’s something up with one of your shortcodes that’s causing this PHP notice to be littered all throughout my debug.log file.
The notice I’m seeing in my log is:
[24-Jan-2020 17:14:35 UTC] PHP Notice: Array to string conversion in D:\home\site\wwwroot\wp-includes\shortcodes.php on line 325
As you can see, that is a WP core file. I’ve modified it so I could identify which shortcode was triggering it.
I modified this line in shortcodes.php (because this is the one that was having the error):
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
To this:
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
set_error_handler( function( $errno, $errstr, $errfile, $errline, $errcontext ) {
// error was suppressed with the @-operator
if ( 0 === error_reporting() ) { return false; }
throw new ErrorException( $errstr, 0, $errno, $errfile, $errline );
});
try {
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
} catch( ErrorException $e ) {
fc_debug_log( array(
//'error' => $e,
'message' => $e->getMessage(),
'function_name' => $shortcode_tags[ $tag ],
'attributes' => $attr,
//'content' => $content,
'tag' => $tag,
'm1' => $m[1],
'm6' => $m[6]
) );
}
restore_error_handler();
Elsewhere in the file, I have this function for logging to my debug.log file:
function fc_debug_log($obj)
{
if (is_array($obj) || is_object($obj)) {
error_log(print_r($obj, true));
} else {
error_log($obj);
}
}
Anyway, I was able to identify that it’s coming from your plugin because this is what it outputted whenever I got the array to string conversion error:
[24-Jan-2020 17:14:35 UTC] PHP Notice: Array to string conversion in D:\home\site\wwwroot\wp-includes\shortcodes.php on line 325
[24-Jan-2020 17:14:35 UTC] Array
(
[message] => Array to string conversion
[function_name] => Array
(
[0] => Skyword_Shortcode Object
(
)
[1] => customfields_shortcode
)
[attributes] =>
[tag] => cf
[m1] =>
[m6] =>
)
Is there a reason why your function name is an array and not a string? Can you please update your plugin so it does not cause this notice in WP core? Thank you.
]]>I am getting the PHP notice:
Notice: Undefined variable: image in [..]/wp-content/plugins/skyword-plugin/php/class-skyword-opengraph.php on line 115
Looking at the code, the function involved returns $image, however $image might not be defined if there are no images attached.
]]>See https://www.ads-software.com/support/topic/metacharacters-such-as-n-need-to-be-in-double-quotes
and https://www.ads-software.com/support/topic/metacharacters-such-as-n-for-newline-need-to-be-enclosed-in-double-quotes-no
and https://github.com/wp-plugins/skyword-plugin/pull/1
diff --git a/php/class-skyword-opengraph.php b/php/class-skyword-opengraph.php
index 85657e6..3e4c148 100644
--- a/php/class-skyword-opengraph.php
+++ b/php/class-skyword-opengraph.php
@@ -35,23 +35,23 @@ class Skyword_Opengraph {
if ( $options['skyword_enable_ogtags'] ) {
$image = $this->getImage( $current_post );
- echo '<meta property="og:title" content="'.esc_attr( $title ).'"/>';
- echo '<meta property="og:description" content="' .esc_attr( $description ).'"/>\n';
- echo '<meta property="og:url" content="' .esc_html( get_permalink( $current_post->ID ) ).'"/>\n';
- echo '<meta property="og:site_name" content="' .esc_html (get_option( 'blogname' ) ). '"/>\n';
- echo '<meta property="og:type" content="article"/>\n';
+ echo '<meta property="og:title" content="'.esc_attr( $title )."\"/>";
+ echo '<meta property="og:description" content="' .esc_attr( $description )."\"/>\n";
+ echo '<meta property="og:url" content="' .esc_html( get_permalink( $current_post->ID ) )."\"/>\n";
+ echo '<meta property="og:site_name" content="' .esc_html (get_option( 'blogname' ) ). "\"/>\n";
+ echo "<meta property=\"og:type\" content=\"article\"/>\n";
if ( isset( $image ) ) {
- echo '<meta property="og:image" content="'.esc_attr($image).'"/>\n';
+ echo '<meta property="og:image" content="'.esc_attr($image)."\"/>\n";
}
}
if ( $options['skyword_enable_metatags'] ) {
- echo '<meta name="description" content="' .esc_attr($description).'"/>\n';
+ echo '<meta name="description" content="' .esc_attr($description)."\"/>\n";
}
if ( $options['skyword_enable_googlenewstag'] ) {
if ( null != get_metadata( 'post', $current_post->ID, 'skyword_publication_keywords', true ) ) {
- echo '<meta name="news_keywords" content="' . esc_html( get_metadata( 'post', $current_post->ID, 'skyword_publication_keywords', true ) ).'"/>\n';
+ echo '<meta name="news_keywords" content="' . esc_html( get_metadata( 'post', $current_post->ID, 'skyword_publication_keywords', true ) )."\"/>\n";
} else if ( null != get_metadata( 'post', $current_post->ID, 'skyword_tags', true ) ) {
- echo '<meta name="news_keywords" content="' . esc_html (get_metadata( 'post', $current_post->ID, 'skyword_tags', true ) ).'"/>\n';
+ echo '<meta name="news_keywords" content="' . esc_html (get_metadata( 'post', $current_post->ID, 'skyword_tags', true ) )."\"/>\n";
}
}
]]>
I have created a pull-request here: https://github.com/wp-plugins/skyword-plugin/pull/1
]]>