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
Comments
Comment #2
denes.szabo commentedThe 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.
Comment #3
derrick_relf commentedI just wanted to clarify that changes were made to the shortcode. Is there a workaround that I could use such as rename the function.
Comment #4
JacksonBison commentedThe 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_tagswith_shortcode_get_shortcodesin thenikadevs_cms.modulefile, and it seems to be working fine so far.Lines: 445, 509 and 536
Also replaced
shortcode_is_tagwith_shortcode_get_shortcodeson line 872 ofnd_visualshortcodes.moduleSo far, no issues, but Nikadevs need to fix their theme.
Comment #5
jbratu commentedWhen 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
Comment #6
norar commentedI have the same issue but i could not fix it
Comment #7
ubiquitous commentedThank 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.
Comment #8
cprofessionals commentedThe 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!
Comment #9
Anonymous (not verified) commentedBasically, 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)."
Comment #10
Anonymous (not verified) commentedBasically, 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)."
Comment #11
elbeo commentedI'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.
Comment #12
ddease2 commentedNikadevs replacement module worked for me.
Comment #13
elondaits commentedI 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.
Comment #14
kochavim commentedI'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?
Comment #15
elkin_taharon commentedHello,
@kochavim did you find out how to fix this issue? i'm having the same problem.
Th
Comment #16
elkin_taharon commentednot working for me