Facebook CrashReporter Error detected api facebook-business-php - facebook-php-sdk

I started with facebook business sdk for php. Was following this doc: https://developers.facebook.com/docs/business-sdk/getting-started/ installed without trouble, then tried testing as they instructed, created src/test.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Campaign;
use FacebookAds\Object\Fields\CampaignFields;
$app_id = "{app-id}";
$app_secret = "{appsecret}";
$access_token = "{access-token}";
$account_id = "act_{{adaccount-id}}";
Api::init($app_id, $app_secret, $access_token);
$account = new AdAccount($account_id);
$cursor = $account->getCampaigns();
// Loop over objects
foreach ($cursor as $campaign) {
echo $campaign->{CampaignFields::NAME}.PHP_EOL;
}
filled in the required values. and ran the file. Getting this:
FacebookAds\CrashReporter : Enabled
FacebookAds\CrashReporter : Error detected!
PHP Catchable fatal error: Argument 1 passed to FacebookAds\CrashReporter::buildParamsFromException() must be an instance of Throwable, instance of ErrorException given, called in /var/www/clients/client1/web1/web/vendor/facebook/php-business-sdk/src/FacebookAds/CrashReporter.php on line 146 and defined in /var/www/clients/client1/web1/web/vendor/facebook/php-business-sdk/src/FacebookAds/CrashReporter.php on line 167
Not sure what I am doing wrong. Didnt find much by searching. Can anyone please help?

Related

Wordpress plugin makes website error: crayon-syntax-highlighter

When I enable the plug-in "crayon-syntax-highlighter" version 2.8.4, my website shows nothing in each page.
---Error message:----
Fatal error: Uncaught Error: Call to a member function id() on array in
/var/www/it/wp-content/plugins/
crayon-syntax-highlighter/crayon_formatter.class.php:36
Try to modify this file : crayon_langs.class.php
File location: /wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php
Going to line# 340
[Before]
return preg_replace('/[^\w-+#]/msi', '', $id);
Need to add a '' behind w
[After]
return preg_replace('/[^\w\-+#]/msi', '', $id);
refer to https://crunchify.com/fix-for-crayon-syntax-highlighter-wordpress-plugin-and-php-7-3-fatal-error

Symfony 4.1 ReflectionException : Class does not exist

I keep getting error "ReflectionException : Class does not exist" when access
$em = $args->getEntityManager()
$obj = $args->getEntity()
$meta = $em->getClassMetadata((new \ReflectionClass($obj))->getName());
When I print $meta and exit the process, it seems OK and returns value.
I already tried some solutions: dump autoload, require symfony/form and symfony/config. But I still have no clue.

Error 500 Call to undefined function thrive_get_theme_options() when trying to get to customize in WP

My site uninstalled all plugins so I reactivated and since then I have been greeted by Error 500 everytime I try to get to Customise (WP).
I checked out error_log and it's pointing to the funtions.php line 659 (starts 3rd line down):
function thrive_exclude_category($query)
{
$hide_cat_option = thrive_get_theme_options('hide_cats_from_blog');
if (!is_string($hide_cat_option)) {
$hide_cat_option = "";
}
$hide_categories = is_array(json_decode($hide_cat_option)) ? json_decode($hide_cat_option) : array();
$temp_query_string_part = "";
foreach ($hide_categories as $temp_cat_id) {
$temp_query_string_part .= "-" . $temp_cat_id . " ";
}
This is probably simple stuff, however, I suck. I have been lumbered with maintaining the sites and really have no say in the matter. Thanks in advance
In one of the projects I found this problem too. After study logs and debug project I find this function don't know about another function which used in theme PHP message: PHP Fatal error: Uncaught Error: Call to undefined function thrive_get_theme_options(). The main problem here in filter which running before all files will be included in theme. So function thrive_exclude_category don't find where declared thrive_get_theme_options because pre_get_posts running before we included files:
add_filter('pre_get_posts', 'thrive_exclude_category')
We need run this filter after use after_setup_theme
function run_func(){
add_filter('pre_get_posts', 'thrive_exclude_category', 999);
}
add_action('after_setup_theme', 'run_func`);
After this you not get any error and you can use your filter.
Try reactivate all plugins required by Thrive theme because of Fatal: Call to undefined function thrive_get_theme_options()

How do I call the basic WordPress header files?

I'm making a custom form action.php and currently it looks like this:
<?php
// Collect Data
$first = $_POST["first_name"];
$last = $_POST["last_name"];
$email = $_POST["email"];
$pass = $_POST["password"];
$pass2 = $_POST["confirm_password"];
$cat = $_POST["category"];
$tAndC = $_POST["terms_and_conditions"];
$privacy = $_POST["privacy_policy"];
$newsletter = $_POST["newsletter"];
die();
?>
Essentially nothing going on - the problem though is when I want to call a WordPress hook such as something like this:
$user_name = $email;
$user_id = username_exists( $user_name );
it returns an error:
Fatal error: Call to undefined function username_exists()...
I'm aware that there are probably header files I am not calling for the 'undefined function' to actually run.
I have tried adding at the top of the page: wp_head(); - but I get the following error:
Fatal error: Call to undefined function wp_head()
Include
$base_dir = dirname(dirname(__FILE__));
require_once($base_dir."/wp-load.php");
With your desired path and check
Include wp-load.php file (in the root of your wordpress installation) in your php script file like so,
require_once("/path/to/wordpress/wp-load.php");
you will have to provide the abspath of the wp-load file, now you can use all the functions of wordpress in your php script.

How do I set up FirePHP version 1.0?

I love FirePHP and I've been using it for a while, but they've put out this massive upgrade and I'm completely flummoxed trying to get it to work. I think I'm copying the "Quick Start" code (kind of guessing at whatever changes are necessary for my server configuration), but for some reason, FirePHP's "primary" function, FirePHP::to() isn't doing anything. Can anyone please help me figure out what I'm doing wrong? Thanks.
<?php
define('INSIGHT_IPS', '*');
define('INSIGHT_AUTHKEYS', '290AA9215205F24E5104F48D61B60FFC');
define('INSIGHT_PATHS', __DIR__);
define('INSIGHT_SERVER_PATH', '/doc_root/hello_firephp2.php');
set_include_path(get_include_path . ":/home8/jayharri/php/FirePHP/lib"); // path to FirePHP library
require_once('FirePHP/Init.php');
$inpector = FirePHP::to('page');
var_dump($inspector);
$console = $inspector->console();
$console->log('hello firephp');
?>
Output:
NULL
Fatal error: Call to a member function console() on a non-object in /home8/jayharri/public_html/if/doc_root/hello_firephp2.php on line 14
The inspector variable is spelled wrong where you are assigning it and you are missing a bracket when getting the include path.
Try the following:
define('INSIGHT_IPS', '*');
define('INSIGHT_AUTHKEYS', '290AA9215205F24E5104F48D61B60FFC');
define('INSIGHT_PATHS', __DIR__);
define('INSIGHT_SERVER_PATH', '/doc_root/hello_firephp2.php');
set_include_path(get_include_path() . ":/home8/jayharri/php/FirePHP/lib");
require_once('FirePHP/Init.php');
$inspector = FirePHP::to('page');
$console = $inspector->console();
$console->log('hello firephp');
Also, according to the INSIGHT_SERVER_PATH constant make sure you have a script with FirePHP installed at:
http:://<hostname>/doc_root/hello_firephp2.php

Resources