Since version 7.x-2.23, i have the following critical failure (error 500)

Error: Call to undefined function _shortcode_tags() in _nikadevs_cms_shortcode_process() (line 429 of /var/www/vhosts/gamerspotter.com/httpdocs/sites/all/modules/nikadevs_cms/nikadevs_cms.module)

I am using a Theme from nikadev which is using this function in nikadevs_cms.module:

line 429:

   444   // Save the Shortcodes in the local cache.
   445   _shortcode_tags($shortcodes_enabled); 

If this function is deprecated, whats the alternative?

Thanks in advance

Issue fork shortcode-2918073

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Schroeffu created an issue. See original summary.

denes.szabo’s picture

Status: Active » Closed (works as designed)

The function changed on 2017-02-13 with this commit: http://cgit.drupalcode.org/shortcode/commit/?id=08bf73d3fe2ad382c316c0ec...

We usually uses "_" started functions as inner, as private functions. Usually, we do not calling them - only if we tested if it exists or not before.

We have hooks, the theme developer should use them.

derrick_relf’s picture

I just wanted to clarify that changes were made to the shortcode. Is there a workaround that I could use such as rename the function.

JacksonBison’s picture

The problem here is the nikadevs_cms module.

Realistically, if Nikadevs are going to borrow functions from another module, they should really copy the entire code into their own module and create their own functions to stop issues like this from occurring.

Nevertheless, I have replaced all instances of _shortcode_tags with _shortcode_get_shortcodes in the nikadevs_cms.module file, and it seems to be working fine so far.

Lines: 445, 509 and 536

Also replaced shortcode_is_tag with _shortcode_get_shortcodes on line 872 of nd_visualshortcodes.module

So far, no issues, but Nikadevs need to fix their theme.

jbratu’s picture

When I renamed the function the error disappeared but substantial parts of my site no longer loaded. It appears the developer is aware of the problem and posted an update

norar’s picture

I have the same issue but i could not fix it

ubiquitous’s picture

Thank you JacksonBison for fix #4.
I've noticed that line 508 in nikadevs_cms.module should to be fixed too:
$str = _shortcode_process_tag($m);
need to be
$str = _shortcode_process_tag($m, $filter);
otherwise error "ArgumentCountError: Too few arguments to function _shortcode_process_tag(), 1 passed in sites/all/modules/nikadevs_cms/nikadevs_cms.module on line 508 and exactly 2 expected in function _shortcode_process_tag() (line 336 sites/all/modules/shortcode/shortcode.module)."
is appear.

cprofessionals’s picture

The combination of #4 and #7 worked for me.
NOTE: the line numbers were not the same, but a search and replace found them all. Thanks!

Anonymous’s picture

Basically, the combination of #4 and #7 worked for me too. But now I get some notices and warnings from the shortcode module:

"Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 156 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 157 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 159 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Warning: Invalid argument supplied for foreach() in _shortcode_get_shortcodes() (Zeile 159 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 168 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module)."

Anonymous’s picture

Basically, the combination of #4 and #7 worked for me too. But now I get a lot of warnings and notices from the shortcode module:

"Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 156 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 157 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 159 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Warning: Invalid argument supplied for foreach() in _shortcode_get_shortcodes() (Zeile 159 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module).

Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (Zeile 168 von /var/www/vhosts/smarte-seiten.de/httpdocs/hcode.dev-ok.de/sites/all/modules/shortcode/shortcode.module)."

elbeo’s picture

I'm using a them from Nikadevs as well and received an update of the theme. Looks like Nikadevs corrected the nikadevs_cms module according to #4 an #7, included in the package is shortcode 7.x-2.26 and everything runs fine now.

ddease2’s picture

Nikadevs replacement module worked for me.

elondaits’s picture

I came here to warn against the fixes proposed in #4 and #7. They make the errors go away but also break the shortcode filters, so the error displays only text instead of the visual shortcodes.

I assume the fix from Nikadevs works but I'm doing changes for a customer who is the one that bought the theme and I don't have his login data to download the update (yet). Downgrading shortcode to v7.x-2.2 worked for now.

kochavim’s picture

I'm experiencing the same issue as elondaits.

The issue about Call to undefined function _shortcode_tags() is gone, however I'm getting
Notice: Trying to get property of non-object in _shortcode_get_shortcodes() (line 168 of /Applications/MAMP/htdocs/xyz/sites/all/modules/contrib/shortcode/shortcode.module).

Anyone got an idea how to fix that?

elkin_taharon’s picture

Hello,

@kochavim did you find out how to fix this issue? i'm having the same problem.

Th

elkin_taharon’s picture

not working for me

isadra made their first commit to this issue’s fork.