Whoops \ Exception \ ErrorException (E_NOTICE)
Trying to get property 'labels' of non-object Whoops\Exception\ErrorException thrown with message "Trying to get property 'labels' of non-object" Stacktrace: #8 Whoops\Exception\ErrorException in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Models/API/Product.php:24 #7 Whoops\Run:handleError in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Models/API/Product.php:24 #6 Syltaen\Product:__construct in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Controllers/SingleProductController.php:49 #5 Syltaen\SingleProductController:getProduct in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Controllers/SingleProductController.php:17 #4 Syltaen\SingleProductController:__construct in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/app/Helpers/Route.php:38 #3 Syltaen\Route:respond in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/index.php:10 #2 include in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-includes/template-loader.php:106 #1 require_once in /var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-blog-header.php:19 #0 require in /var/www/vhosts/vinspirard.hungryminds.host/espaces/index.php:17
Stack frames (9)
8
Whoops\Exception\ErrorException
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Models/API/Product.php24
7
Whoops\Run handleError
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Models/API/Product.php24
6
Syltaen\Product __construct
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Controllers/SingleProductController.php49
5
Syltaen\SingleProductController getProduct
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Controllers/SingleProductController.php17
4
Syltaen\SingleProductController __construct
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/app/Helpers/Route.php38
3
Syltaen\Route respond
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/index.php10
2
include
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-includes/template-loader.php106
1
require_once
/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-blog-header.php19
0
require
/var/www/vhosts/vinspirard.hungryminds.host/espaces/index.php17
class Product
{
    /**
     * The remote URL used to fetch products
     */
    const REMOTE = "https://vinspirard.be";
    // const REMOTE     = "http://localhost/pirard";
 
    const AJAX_MULTIPLE = "pirard_get_products";
    const BASEPATH      = "produit";
 
    public function __construct($product_name, $type = "basic")
    {
        // Get props from api/cache
        switch ($type) {
            case "full":
                $single = json_decode((new Request(static::REMOTE . "/produit/{$product_name}/?json"))->get()->responseBody);
                if (!empty($single->error)) return false;
 
                $this->labels        = $single->labels;
                $this->carac         = static::filterCarac(static::replaceUrlInCaracs($single->carac));
                $this->avis          = $single->avis;
                $this->grower        = $single->grower;
                $this->related_title = $single->related_title;
                $this->related       = static::replaceUrlInProducts($single->related_products);
 
                $product             = $single->post;
                break;
            case "basic":
            default:
                $product = (new Cache("products/basic/{$product_name}"))->get(function () use ($product_name) {
                    return json_decode((new Request(static::REMOTE . "/api/getProduct/{$product_name}"))->get()->responseBody);
                });
                break;
        }
 
        if (!$product) return false;
 
        // Spread props
        foreach ($product as $prop=>$value) {
Arguments
  1. "Trying to get property 'labels' of non-object"
    
class Product
{
    /**
     * The remote URL used to fetch products
     */
    const REMOTE = "https://vinspirard.be";
    // const REMOTE     = "http://localhost/pirard";
 
    const AJAX_MULTIPLE = "pirard_get_products";
    const BASEPATH      = "produit";
 
    public function __construct($product_name, $type = "basic")
    {
        // Get props from api/cache
        switch ($type) {
            case "full":
                $single = json_decode((new Request(static::REMOTE . "/produit/{$product_name}/?json"))->get()->responseBody);
                if (!empty($single->error)) return false;
 
                $this->labels        = $single->labels;
                $this->carac         = static::filterCarac(static::replaceUrlInCaracs($single->carac));
                $this->avis          = $single->avis;
                $this->grower        = $single->grower;
                $this->related_title = $single->related_title;
                $this->related       = static::replaceUrlInProducts($single->related_products);
 
                $product             = $single->post;
                break;
            case "basic":
            default:
                $product = (new Cache("products/basic/{$product_name}"))->get(function () use ($product_name) {
                    return json_decode((new Request(static::REMOTE . "/api/getProduct/{$product_name}"))->get()->responseBody);
                });
                break;
        }
 
        if (!$product) return false;
 
        // Spread props
        foreach ($product as $prop=>$value) {
Arguments
  1. 8
    
  2. "Trying to get property 'labels' of non-object"
    
  3. "/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/Models/API/Product.php"
    
  4. 24
    
  5. array:3 [
      "product_name" => "2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron"
      "type" => "full"
      "single" => null
    ]
    
        // On add-to-cart
        if (isset($_POST["add-to-cart"])) {
            $this->addToCart();
        }
 
        $this->data["product"] = $this->product;
        $this->addBodyClass("single-product");
        $this->setPageTitle(get_bloginfo("name") . " - " . $this->data["product"]->post_title);
    }
 
 
    /**
     * Get the product from the remote API
     *
     * @param array $args
     * @return void
     */
    public function getProduct($args)
    {
        return new Product($args["product_name"], "full");
    }
 
 
    /**
     * Add the product to the cart
     *
     * @return void
     */
    public function addToCart()
    {
        $quantity = $_POST["quantity"] ?? 1;
 
        // Add to cart
        Cart::add($this->product->ID, $quantity);
 
        // Success message
        $success  = $quantity > 1
            ? sprintf("%s × «%s» ont été ajoutés à votre panier.", $quantity, $this->product->post_title)
            : sprintf("«%s» a été ajouté à votre panier.", $this->product->post_title);
 
Arguments
  1. "2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron"
    
  2. "full"
    
<?php
 
namespace Syltaen;
 
class SingleProductController extends BaseController
{
 
    public $view = "single-product";
 
    /**
     * Populate $this->data
     */
    public function __construct($args = [])
    {
        parent::__construct($args);
 
        $this->product = $this->getProduct($args);
        $this->product->tags = $this->product->getTags();
 
        // Product not found : error 404
        if (empty($this->product->url)) {
            (new PageController)->error404(); exit;
        }
 
        // Auto-empty grower if not completely filled
        if (empty($this->product->grower->description) || empty($this->product->grower->img)) {
            $this->product->grower = false;
        }
 
        // On add-to-cart
        if (isset($_POST["add-to-cart"])) {
            $this->addToCart();
        }
 
        $this->data["product"] = $this->product;
        $this->addBodyClass("single-product");
        $this->setPageTitle(get_bloginfo("name") . " - " . $this->data["product"]->post_title);
    }
 
 
Arguments
  1. array:1 [
      "product_name" => "2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron"
    ]
    
        // Clear obsolete flash data
        if (!$same_session_page) {
            Data::goToNextSessionPage();
        }
 
        // Class method call
        if (is_string($resp)) {
 
            // Extracts method
            $method = false;
            if (preg_match('/(.*)::(.*)/', $resp, $keys)) {
                $resp = $keys[1];
                $method = $keys[2];
            }
 
            // Add namespace to class
            $classname = "Syltaen\\$resp";
 
            // Instanciate the class with the arguments
            $class = new $classname($args);
 
            // Lauch mehtod if any
            if ($method) {
                $class->$method();
            }
        }
 
        // Closure function call
        if (is_callable($resp)) {
            $resp($args);
        }
 
        exit;
    }
 
    // ==================================================
    // > RULES
    // ==================================================
    public static function any($resp, $args = [])
    {
Arguments
  1. array:1 [
      "product_name" => "2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron"
    ]
    
<?php
 
namespace Syltaen;
 
// ==================================================
// > SINGLES
// ==================================================
if (!empty(Route::qvar("product_name"))) {
    Route::respond("SingleProductController::render", [
        "product_name" => Route::qvar("product_name")
    ]);
}
 
if (!empty(Route::qvar("earlywine_name"))) {
    Route::respond("SingleEarlyWineController::render", [
        "earlywine_name" => Route::qvar("earlywine_name")
    ]);
}
 
 
Route::is("single", "SingleController::render");
 
// ==================================================
// > SEARCH
// ==================================================
Route::is("search", "PageController::search", ["search" => get_search_query(false)]);
 
// ==================================================
// > API
// ==================================================
Route::custom("api", "ApiController", ["method", "target", "mode"]);
 
// ==================================================
// > NINJA FORM PREVIEW
// ==================================================
Route::query("nf_preview_form", "PageController::ninjaFormPreview");
 
// ==================================================
// > PAGES
// ==================================================
Arguments
  1. "SingleProductController"
    
  2. array:1 [
      "product_name" => "2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron"
    ]
    
            }
 
            break;
        }
    }
 
    if ( ! $template ) {
        $template = get_index_template();
    }
 
    /**
     * Filters the path of the current template before including it.
     *
     * @since 3.0.0
     *
     * @param string $template The path of the template to include.
     */
    $template = apply_filters( 'template_include', $template );
    if ( $template ) {
        include $template;
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
}
 
Arguments
  1. "/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-content/themes/syltaen/index.php"
    
<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */
 
if ( ! isset( $wp_did_header ) ) {
 
    $wp_did_header = true;
 
    // Load the WordPress library.
    require_once __DIR__ . '/wp-load.php';
 
    // Set up the WordPress query.
    wp();
 
    // Load the theme template.
    require_once ABSPATH . WPINC . '/template-loader.php';
 
}
 
Arguments
  1. "/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-includes/template-loader.php"
    
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
 
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );
 
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
 
Arguments
  1. "/var/www/vhosts/vinspirard.hungryminds.host/espaces/wp-blog-header.php"
    

Environment & details:

empty
empty
empty
empty
Key Value
syltaen_current_page
[]
syltaen_messages
[]
Key Value
SERVER_SOFTWARE
"Apache"
REQUEST_URI
"/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
USER
"vinspirard"
HOME
"/var/www/vhosts/vinspirard.hungryminds.host"
SCRIPT_NAME
"/index.php"
QUERY_STRING
""
REQUEST_METHOD
"GET"
SERVER_PROTOCOL
"HTTP/1.0"
GATEWAY_INTERFACE
"CGI/1.1"
REDIRECT_URL
"/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
REMOTE_PORT
"54430"
SCRIPT_FILENAME
"/var/www/vhosts/vinspirard.hungryminds.host/espaces/index.php"
SERVER_ADMIN
"[no address given]"
CONTEXT_DOCUMENT_ROOT
"/var/www/vhosts/vinspirard.hungryminds.host/espaces"
CONTEXT_PREFIX
""
REQUEST_SCHEME
"https"
DOCUMENT_ROOT
"/var/www/vhosts/vinspirard.hungryminds.host/espaces"
REMOTE_ADDR
"3.239.56.184"
SERVER_PORT
"443"
SERVER_ADDR
"172.31.40.112"
SERVER_NAME
"aimelevin.vinspirard.be"
SERVER_SIGNATURE
"<address>Apache Server at aimelevin.vinspirard.be Port 443</address>\n"
PATH
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
HTTP_ACCEPT_ENCODING
"br,gzip"
HTTP_ACCEPT_LANGUAGE
"en-US,en;q=0.5"
HTTP_ACCEPT
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_USER_AGENT
"CCBot/2.0 (https://commoncrawl.org/faq/)"
HTTP_CONNECTION
"close"
HTTP_X_ACCEL_INTERNAL
"/internal-nginx-static-location"
HTTP_X_REAL_IP
"3.239.56.184"
HTTP_HOST
"aimelevin.vinspirard.be"
proxy-nokeepalive
"1"
HTTPS
"on"
SCRIPT_URI
"https://aimelevin.vinspirard.be/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
SCRIPT_URL
"/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
UNIQUE_ID
"YJuRaawfKHAAAGwHzvMAAAAP"
REDIRECT_STATUS
"200"
REDIRECT_HTTPS
"on"
REDIRECT_SCRIPT_URI
"https://aimelevin.vinspirard.be/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
REDIRECT_SCRIPT_URL
"/produit/2018-rouge-chateau-petit-boyer-blaye-la-passion-cotes-de-bordeaux-jean-vincent-bideau-vigneron/"
REDIRECT_UNIQUE_ID
"YJuRaawfKHAAAGwHzvMAAAAP"
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1620808041.9621
REQUEST_TIME
1620808041
empty
0. Whoops\Handler\PrettyPageHandler