Fatal error: Cannot redeclare function() - WP theme - php

We recently went through a website migration, PHP & WP upgrades. We are currently using a customized theme and keep getting the following error once we upgrade from PHP 5.6 to 7.0:
Fatal error: Cannot redeclare get_resources() (...) /functions.php on line 220
Already changed all include to include_once, but still getting the same error.
Anyone ever went through a similar issue?

PHP introduced a function called get_resources() in PHP7:
get_resources
(PHP 7)
get_resources — Returns active resources
Read full manual entry here.
--
You'll have to upgrade your WordPress version to the latest out - the fix will be in there.

Related

Call to undefined method WP_Textdomain_Registry::reset()

My Wordpress site is broken and only shows this error message:
Fatal error: Uncaught Error: Call to undefined method WP_Textdomain_Registry::reset() in /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php:139
Stack trace:
#0 /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php(119): WPML\ST\MO\Hooks\LanguageSwitch->resetTranslationAvailabilityInformation()
#1 /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php(73): WPML\ST\MO\Hooks\LanguageSwitch->changeMoObjects('view-subscripti...')
#2 /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/TranslateWpmlString.php(167): WPML\ST\MO\Hooks\LanguageSwitch->switchToLocale('view-subscripti...')
#3 /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/TranslateWpmlString.php(109): WPML\ST\Trans in /var/www/htdocs/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LanguageSwitch.php on line 139
I can only access the site after adding ".disabled" to the plugin folder (wpml-string-translation) name but this disables the plugin and the site needs it to work.
It is a problem that is occurring with the update to wordpress 6.1.
To fix it you need to update WPML to 4.5.12 and String Translation to 3.2.3
Source: https://wpml.org/changelog/2022/10/wpml-4-5-12-updates-for-wordpress-6-1/
-- Edit:
After downloading the two updated plugins, rename the two folders related to the plugins and install the updated versions to solve the problem
I just removed string 139. Everything is working at the moment
Had the same issue today.
This issue is due to none updated version of WPML and compatibility with 6.1 WordPress. Since WPML website is today down and you can not download the plugin.
There is github repository:
https://github.com/youssef-lmw/wpml-string-translation
Download this version of the plugin
List item replaces current one in wpml-string-translation folder
I downloaded https://github.com/youssef-lmw/wpml-string-translation/archive/refs/heads/main.zip an remplace wpml-string-translation folder in wp-content/plugins/wpml-string-translation and fixed problem.
WPML String Translation for Wordpress 6.1
FIX error: Fatal error: Uncaught Error: Call to undefined method WP_Textdomain_Registry::reset()
While the WPML.org site is down, you can downgrade WordPress itself to version 6.0, either

Fatal error: f_imageloadfont is not supported: NYI in HHVM

Getting the following error from gd using HHVM 3.7.1
Fatal error: f_imageloadfont is not supported: NYI
I couldn't help to ask as I didn't find any information about how to fix it.
This error did not happen to occur in PHP 5.3, 5.4 and 5.6 (didn't test 5.5).
Update: If you are interested - I opened an issue.
The main part here is imageloadfont is not supported, which means calling it will cause a fatal error like the one you're seeing.
You could open an issue about it to see if it can be implemented, or if the HNI definition can be removed so that a function_exists for it fails.

Drupal Fatal error: Call to undefined function views_get_enabled_views()

I use drupal 7.22 with Apache 2.2 , mysql 5.5 and PHP 5.3.
I'm having the error of WSOD, and when I enable the error message, it shows:
Fatal error: Call to undefined function views_get_enabled_views() in
/var/www/drupal7/sites/all/modules/admin_menu/admin_menu.map.inc on
line 150
It happens when I migrate the whole drupal to another system, or when I update the core to the recent released version, WHERE I enter the username and password to access the administration page ( /drupal-address/user).
You got this error because of view does not support some function of new drupal
check last reply on this link
https://drupal.org/node/1778470
Also
https://drupal.org/node/1170192

Drupal failed after update

I just updated Drupal core from 7.4 to 7.26. After running update.php site stopped working – both public and admin part. When I load it fatal error occurs:
Fatal error: Call to undefined function _system_default_theme_features() in /[drupal_path]/includes/theme.inc on line 1422
and when I reload it another fatal error apperars:
Fatal error: Call to a member function getDirectoryPath() on a non-object in /[drupal_path]/modules/image/image.module on line 83
next reload – first error, one more – second. Also, second error is loading much faster.
And one more thing, after applaying update.php I got one failed, I don't know if this is connected:
media_gallery module
Update #7009
Failed: FieldException: Próba aktualizacji egzemplarza nieistniejącego pola media_gallery_media. w field_update_instance() (linia 557 z /[drupal_path]/modules/field/field.crud.inc).
which is something like:
Failed: FieldException: Attempt to update an instance of a nonexistent field media_gallery_media. in field_update_instance() (line 557 in /[drupal_path]/modules/field/field.crud.inc).
PHP Version 5.5.6
Any tips where the problem is? I was trying disabling some modules from db, but this did't help.
It's difficult to explain the reason and to provide a solution.
My attempt would be to copy the DB and the files on a neutral platform (local machine or so) and experiment with the update.php script.
My suspicion would be that media module needs also update since it's using the old URI function definition (call). Also try to update other modules that are working with files.
The update is quite big since 7.4 to 7.22 (years of improvement). Reading the change log would be helpful but not realistic.
Did you also cleared the cache? (via drush if the web interface not working - /?q=admin/config/development/performance)
Please don't forget to post the solution if you find one for other users with the same issue.

"Fatal error: Call to undefined function" resulting in particular local server, but ran well in others'

I'm developing a PHP application which generating reports to PDF
Right now I'm facing some troubles
I'm working from my own computer with XAMPP Server and the code ran well
But when I copied the codes to my office's WAMP5 Version 1.6.5 Server I got errors
Fatal error: Call to undefined function array_fill_keys() in D:\wwwroot\tcpdf\include\tcpdf_fonts.php on line 1848
I went to that troubled line and removed it, but another Fatal error: Call to undefined function occured
Is there something wrong with my WAMP5 configuration?
Thanks
Your version of php is to old... as Royal Bg suspected.
Either upgrade to 1.6.6 for php 5.2. But if there is no reason to use such an old version switch to something less than 7 years old :)
see:
http://sourceforge.net/p/wampserver/news/?source=navbar

Categories