• Resolved colinrc

    (@colinrc)


    Hi,
    I have found that the find shortcode plugin breaks when the leaflet plugin is present.

    I have done some digging and it seems to be in the …util.php file. It is expecting $callback[0] to be an object where it seems to be a string for tags from this plugin. If I add the code below the search works correct – and the error log lists the offending items. Without doing this I get a 500; I have the Leaflet Map and Extensions for Leaflet Map plugins installed (and can’t deactivate them as it is them that I need to search for!)

    function sf_admin_page_shortcode_origin( $callback ) { 
    	
        try {
            if ( is_array( $callback ) ) {
    			$callback_type     = 'class';
    
    <strong>			if (is_string($callback[0])) {
    				error_log( "<P>element is " . $callback[0] ) ;
    				return null;
    			}
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Geojson_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Image_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Kml_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Gpx_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Line_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Polygon_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Circle_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Map_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Marker_Shortcode
    [24-May-2022 11:38:25 UTC] <P>element is Leaflet_Scale_Shortcode

    I have managed to get it working for my purposes but I am hoping this is useful for you regarding the plugin.

    Thanks for a really useful tool.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Scribit

    (@scribit)

    Hi @colinrc and thanks for your report.
    I’ve just installed Leaflet Map and Extensions for Leaflet Map plugins, then I’ve added these 3 shortcodes in a published page:

    [elevation gpx=sampleurl.com/sample.gpx]
    [leaflet-map lat=34.131342635014924 lng=-63.457031250000014 zoom=2]
    [leaflet-marker lat=44.67 lng=-63.61]

    The page is working well.

    When I use “Find by Shortcode”, “Find by Content” or “Documentation” Shortcodes Finder functionalities they works as aspected with no errors and shows me the inserted shortcodes.
    Can you try my simple example and give me a feedback? Otherwise can you give me a more specific example to reproduce the error?

    And finally…consider voting our plugin if really you like it 🙂

    • This reply was modified 3 years, 10 months ago by Scribit.
    Plugin Author Scribit

    (@scribit)

    The problem you’ve reported is related to a PHP 8 partial incompatibiliy.
    I’ve just released the 1.5 plugin version with a fix for your issue.

    Thread Starter colinrc

    (@colinrc)

    Thanks for letting me know,I did a quick check and it all seems good.

    Also thanks for the really useful plugin.

    Thread Starter colinrc

    (@colinrc)

    Hi,
    Unfortunately, it’s still breaking at times; only with a shortcode that is present. It does the find, then gives an error trying to display the results…

    Shortcode to search:     Include not published contents   
    
    Shortcode uses found:
    
    There has been a critical error on this website. Please check your site admin email inbox for instructions.
    
    ------------
    
    From my php error log
    
    

    PARSE2022-05-24 21:32:53
    Unclosed ‘(‘ does not match ‘]’ in /home2/shakenma/public_html/words_colincanfield/wp-content/plugins/shortcodes-finder/includes/shortcodes-finder-utils.php on line 301
    FATAL2022-05-24 21:29:23
    Uncaught Error: Call to undefined function isinstance() in /home2/shakenma/public_html/words_colincanfield/wp-content/plugins/shortcodes-finder/includes/shortcodes-finder-utils.php:301
    PARSE2022-05-24 21:27:58
    syntax error, unexpected token “;” in /home2/shakenma/public_html/words_colincanfield/wp-content/plugins/shortcodes-finder/includes/shortcodes-finder-utils.php on line 302`

    I do not think this line number is correct as that is commented-out code!

    Happy to provide any debugging help if it’s useful.

    Plugin Author Scribit

    (@scribit)

    `Hi @colinrc .
    Yes it is strange that line 301 was signaled. Probably the problem is related to reflection methods, in another line.

    First of all please let me know which PHP version do you have.
    And here some tests you can do:

    1) Can you try searching specific leaflet shortcode instead of “all”, in the Search by shortcode page? To be sure it is the culprit
    2) If it is the source of the problem can you give me some shortcode call example?
    3) If not, can you search the function isinstance in all your plugin directory? (I don’t call the isInstance reflection method – https://www.php.net/manual/en/reflectionclass.isinstance.php – so maybe someone else is calling or declaring it)
    4) In this file “shortcodes-finder\admin\partials\shortcodes-finder-admin-display.php”, on line 217 change the row from
    $all_shortcodes = sf_get_shortcodes_ordered( true ); // Load origins
    to
    $all_shortcodes = sf_get_shortcodes_ordered( );
    It will not search for shortcodes origin file, calling reflection methods. It probably will work; you will have less informations about shortcodes calls but more informations for debugging the problem.

    Thanks again for support!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Leaflet plugin breaks this plugin’ is closed to new replies.