PHP Fatal error: Uncaught Error: Call to undefined function - php

I have recently migrated from the old PHP5xx to PHP7.4.23 version and below is the error message when localhost URL is tested. I can confirm the index.php has reference to include rightbar.php from the same folder destination. If I remove the reference to rightbar.php then the website loads perfectly. I am not a coder but would need some great help on this.
Website error:`PHP Fatal error:
Uncaught Error: Call to undefined function getResultBYkeyword() in
C:\inetpub\wwwroot\tamilmelisai\rightbar.php:169 Stack trace:
#0 C:\inetpub\wwwroot\tamilmelisai\index.php(28): include()
#1 {main} thrown in C:\inetpub\wwwroot\tamilmelisai\rightbar.php on line 169`
Line 169 of rightbar.php has the following code:
<?php $videoDetailstops = getResultBYkeyword("latest tamil trailers",3); if(count($videoDetailstops)):?>

After lots and trial and error, fianlly below is the solution that I worked it out even though I am not a coder by any chance. Appreciate all those who looked at the query and responded.
Form this:
<?php $videoDetailstops = getResultBYkeyword("latest tamil trailers",3); if(count($videoDetailstops)):?>
To this:
<?php if (isset ($videoDetailstops) && $videoDetailstops = getResultBYkeyword("latest tamil trailers",3));?>

Related

WordPress - Fatal error: Uncaught Error: Undefined constant "SBVCGMAP_PLUGIN_VERSION"

I just moved my wordpress site from a server to my localhost to make some changes.
The websites on the server works great. But when i run it on localhost i get this.
Fatal error: Uncaught Error: Undefined constant "SBVCGMAP_PLUGIN_VERSION" in
/opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/inc/sb-google-
maps-vc-addon/sb-google-maps-vc-addon.php:3 Stack trace: #0
/opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/modeltheme-
framework.php(65): require_once() #1 /opt/lampp/htdocs/cruiceWP/wp-settings.php(409):
include_once('/opt/lampp/htdo...') #2 /opt/lampp/htdocs/cruiceWP/wp-config.php(90):
require_once('/opt/lampp/htdo...') #3 /opt/lampp/htdocs/cruiceWP/wp-load.php(50):
require_once('/opt/lampp/htdo...') #4 /opt/lampp/htdocs/cruiceWP/wp-blog-
header.php(13): require_once('/opt/lampp/htdo...') #5
/opt/lampp/htdocs/cruiceWP/index.php(17): require('/opt/lampp/htdo...') #6 {main}
thrown in /opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/inc/sb-
google-maps-vc-addon/sb-google-maps-vc-addon.php on line 3
Notice: is_embed was called incorrectly. The conditional functions do not work before the
query is executed. Before the basic application they give false. Please see the Debugging
in WordPress page for more information. (This message was added in version 3.1.0.) In
/opt/lampp/htdocs/cruiceWP/wp-includes/functions.php on line 5535
Notice: is_search was called incorrectly. The conditional functions do not work before
the query is executed. Before the basic application they give false. Please see the
Debugging in WordPress page for more information. (This message was added in version
3.1.0.) In /opt/lampp/htdocs/cruiceWP/wp-includes/functions.php on line 5535
This is the file that has the problem as the error message says.
sb-google-maps-vc-addon.php
<?php
#define(SBVCGMAP_PLUGIN_VERSION,'1.4'); //Plugin Version
#define(SBVCGMAP_PLUGIN_NAME, 'MT Google Maps'); //Plugin Name
#define(SBVCGMAP_PLUGIN_DIR, trim(plugin_dir_url(__FILE__), '/')); //Plugin Dir
#define(SBVCGMAP_PLUGIN_PATH, trim(plugin_dir_path(__FILE__), '/')); //Plugin Path
//Including all common functions
include('inc/functions.php');
//Including admin panel
include('admin/admin-panel.php');
//Including shortcodes
include('shortcodes.php');
Im stuck for days in this. Does anyone have any idea?
PHP constant names need to be defined as strings. Prior to PHP 8, if you passed an unquoted string, PHP would raise a warning but still treat it as a string which is why that developer included the silencing # operator.
The fix is to quote the names, and I’d remove the #, too
define('SBVCGMAP_PLUGIN_VERSION','1.4');

Cloudinary AI background removal fatal error

I am trying to use Cloudinary AI background removal tool. This is the code I am using (Code snippet provided by Cloudinary)
if(isset($_POST["submit"])){
\Cloudinary\Uploader::upload("https://www.popwebdesign.net/popart_blog/wp-content/uploads/2019/05/slike-prirode-za-desktop-757.jpg",
array(
"public_id" => "dog_couch",
"background_removal" => "cloudinary_ai"
));
}
I get this error
Fatal error: Uncaught Error: Class 'Cloudinary\Error' not found in /storage/ssd5/884/7393884/public_html/Uploader.php:534 Stack trace: #0 /storage/ssd5/884/7393884/public_html/Uploader.php(408): Cloudinary\Uploader::call_api('upload', Array, Array, 'https://www.pop...') #1 /storage/ssd5/884/7393884/public_html/Uploader.php(101): Cloudinary\Uploader::call_cacheable_api('upload', Array, Array, 'https://www.pop...') #2 /storage/ssd5/884/7393884/public_html/index.php(13): Cloudinary\Uploader::upload('https://www.pop...', Array) #3 {main} thrown in /storage/ssd5/884/7393884/public_html/Uploader.php on line 534
When I use part just for uploading it works perfectly
if(isset($_POST["submit"])){
\Cloudinary\Uploader::upload("https://www.popwebdesign.net/popart_blog/wp-content/uploads/2019/05/slike-prirode-za-desktop-757.jpg");
}
as soon as I add array part I get the error. I can't see what I am doing wrong since this code is directly from cloudinary. I've found it here: https://cloudinary.com/documentation/cloudinary_ai_background_removal_addon
I have tried to search the internet, but could not find a solution for this.
Any help is appreciated!

Server error (5xx) being reported by Google Webmaster Tools

We are getting Server error (5xx) via our Google Search Console. Do you know why this is happening? And is there a solution to fix this?
When I checked error_log we found something like these:
[21-Aug-2019 06:11:11 UTC] PHP Fatal error: Call to undefined function twentysixteen_excerpt() in /home/teedupgolf/public_html/wp-content/themes/teedup/image.php on line 49
[21-Aug-2019 06:11:39 UTC] PHP Fatal error: Call to undefined function twentysixteen_excerpt() in /home/teedupgolf/public_html/wp-content/themes/teedup/image.php on line 49
[21-Aug-2019 06:12:03 UTC] PHP Fatal error: Call to undefined function twentysixteen_excerpt() in /home/teedupgolf/public_html/wp-content/themes/teedup/image.php on line 49
Most pages looks like automatically generated, here are the example pages:
https://teedupgolftours.com/2015/01/
https://teedupgolftours.com/category/uncategorized/
https://teedupgolftours.com/2015/07/
What we have done for now, we just disallow these links on robots.txt
I had the same mistake.
If the site uses multiple languages, please use hreflang like the following example:
<link rel = "alternate" href = "https://smsreceive.site/Home/en" hreflang = "x-default" />

Fatal error: Uncaught Error: Function name must be a string (Responsive Google Maps WP Plugin - Metabox.php on line 115)

Hello fellow developers and problem-solvers,
I'm running into a PHP7 issue it seems where my code needs to be updated for:
/home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php on line 115
I did some searches and wasn't able to find this particular issue with other threads on Stack Overflow. I'm somewhat familiar with PHP, but not a guru at working with core PHP files. I'm more of a front-end/full-stack developer.
Error Shown on the sidebar: "Responsive Google Maps" WordPress Plugin
Fatal error: Uncaught Error: Function name must be a string in /home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php:115 Stack trace: #0 /home/wp-theme/public_html/wp-admin/includes/template.php(1048): ResponsiveGoogleMaps_MarkAdCoreClasses_Metabox->render_metabox_content(Object(WP_Post), Array) #1 /home/wp-theme/public_html/wp-admin/edit-form-advanced.php(696): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/wp-theme/public_html/wp-admin/post.php(173): include('/home/wp-theme...') #3 {main} thrown in /home/wp-theme/public_html/wp-content/plugins/responsive-google-maps/classes/MarkAdCoreClasses/Metabox.php on line 115
Source code: Metabox.php on line 115
$field_output .= $this->form_fields->$field['type'](array($field, $settings['metabox_id'], $passed_values));
Much appreciated if someone can help me. Thanks in advance.
Line 115 seems to be calling a dynamic function, whose name is retrieved from the $field variable of type array within the form_fields object.
The same issue does seem to be reported on the CodeCanyon item page a few years ago here.
I would recommend redownloading the plugin and uploading it to /wp-content/plugins/ folder on the website to see if the latest update resolves the issue.
Managed to fix it, I was right about it being related to PHP7.
Change
$field_output .= $this->form_fields->$field['type'](array($field, $settings['metabox_id'], $passed_values));
to
$field_output .= $this->form_fields->{$field['type']}(array($field, $settings['metabox_id'], $passed_values));

Uncaught exception 'Exception' with message '0' in Stack trace: #0. PHP Insert based off API response

im using RottenTomatoes Api to gain film information. I have a list of 250 films im grabbing information on however i get to a certain point and i get this error. It seems to happen randomly. I'm taking the api results and putting them in my own database. Would there be a reason for such an error?
Fatal error: Uncaught exception 'Exception' with message '0' in /home/ignitet1/public_html/CheckFilm/RottenTomatoes.php:340
Stack trace:
#0 /home/ignitet1/public_html/CheckFilm/RottenTomatoes.php(156): RottenTomatoes->getResource('http://api.rott...')
#1 ****/loadFullData.php(37): RottenTomatoes->getMovieInfo('771269025')
#2 {main}
thrown in ****RottenTomatoes.php</b> on line <b>340</b><br />
on line 340 this is the code. rottentomatoes.php is a php library used to parse the response's from the api.
if (isset($decodedResponse['error']))
throw new Exception('API Error: ' + $decodedResponse['error']);
return $decodedResponse;
Apologies for the poor explanation i'm having trouble finding the code that is causing the issue.
One obvious bug in the code is that this line:
throw new Exception('API Error: ' + $decodedResponse['error']);
should be:
throw new Exception('API Error: ' . $decodedResponse['error']);
Instead of the +, there should be a . for concatenating strings. After that correction, you should see the exception text correctly. However the real problem is why the exception is thrown in the first place, which is probably (due to the if (isset($decodedResponse['error']))) an error retrieved from the server, or the decoding/parsing fails for some reason.
However, there is no answer to why is this happening, because the problem is inside the library, not in the code you posted.

Categories