TypeError
number_format(): Argument #1 ($num) must be of type int|float, string given TypeError thrown with message "number_format(): Argument #1 ($num) must be of type int|float, string given" Stacktrace: #5 TypeError in /home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php:242 #4 number_format in /home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php:242 #3 Lexicon\Currency\Converter:wizardCurrencyString in /home/hplex/live/wp-content/themes/lexicon/currency.php:60 #2 include in /home/hplex/live/www/wp-includes/template-loader.php:132 #1 require_once in /home/hplex/live/www/wp-blog-header.php:19 #0 require in /home/hplex/live/www/index.php:17
Stack frames (6)
5
TypeError
/wp-content/themes/lexicon/lib/Currency/Converter.php:242
4
number_format
/wp-content/themes/lexicon/lib/Currency/Converter.php:242
3
Lexicon\Currency\Converter wizardCurrencyString
/wp-content/themes/lexicon/currency.php:60
2
include
/www/wp-includes/template-loader.php:132
1
require_once
/www/wp-blog-header.php:19
0
require
/www/index.php:17
/home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php
        if ($knuts >= $this->knutsToSickles) {
            $sickles = floor($knuts / $this->knutsToSickles);
            $knuts = $knuts - ($sickles * $this->knutsToSickles);
        }
 
        return [
            'galleons'  => $galleons,
            'sickles'   => $sickles,
            'knuts'     => $knuts,
        ];
    }
 
    public function wizardCurrencyString($currency)
    {
        $inflector = Inflector::get('en');
 
        $stringParts = [];
        if ($currency['galleons']) {
            $galleonString = ($currency['galleons'] > 1)?$inflector->pluralize("Galleon"):"Galleon";
            $stringParts[] = number_format($currency['galleons'], 0) . " {$galleonString}";
        }
        if ($currency['sickles']) {
            $sickleString = ($currency['sickles'] > 1)?$inflector->pluralize("Sickle"):"Sickle";
            $stringParts[] = number_format($currency['sickles'], 0) . " {$sickleString}";
        }
        if ($currency['knuts']) {
            $knutString = ($currency['knuts'] > 1)?$inflector->pluralize("Knut"):"Knut";
            $stringParts[] = number_format($currency['knuts'], 0) . " {$knutString}";
        }
        if (count($stringParts) > 1) {
            $last = array_pop($stringParts);
            if (count($stringParts) > 1) {
                return implode(", ", $stringParts) . ", and " . $last;
            }
            return implode(", ", $stringParts) . " and " . $last;
        }
        return implode(", ", $stringParts);
    }
 
    public function convertCurrency($amount, $rates = null, $source = 'USD', $dest = 'GBP')
Arguments
  1. "number_format(): Argument #1 ($num) must be of type int|float, string given"
    
/home/hplex/live/wp-content/themes/lexicon/lib/Currency/Converter.php
        if ($knuts >= $this->knutsToSickles) {
            $sickles = floor($knuts / $this->knutsToSickles);
            $knuts = $knuts - ($sickles * $this->knutsToSickles);
        }
 
        return [
            'galleons'  => $galleons,
            'sickles'   => $sickles,
            'knuts'     => $knuts,
        ];
    }
 
    public function wizardCurrencyString($currency)
    {
        $inflector = Inflector::get('en');
 
        $stringParts = [];
        if ($currency['galleons']) {
            $galleonString = ($currency['galleons'] > 1)?$inflector->pluralize("Galleon"):"Galleon";
            $stringParts[] = number_format($currency['galleons'], 0) . " {$galleonString}";
        }
        if ($currency['sickles']) {
            $sickleString = ($currency['sickles'] > 1)?$inflector->pluralize("Sickle"):"Sickle";
            $stringParts[] = number_format($currency['sickles'], 0) . " {$sickleString}";
        }
        if ($currency['knuts']) {
            $knutString = ($currency['knuts'] > 1)?$inflector->pluralize("Knut"):"Knut";
            $stringParts[] = number_format($currency['knuts'], 0) . " {$knutString}";
        }
        if (count($stringParts) > 1) {
            $last = array_pop($stringParts);
            if (count($stringParts) > 1) {
                return implode(", ", $stringParts) . ", and " . $last;
            }
            return implode(", ", $stringParts) . " and " . $last;
        }
        return implode(", ", $stringParts);
    }
 
    public function convertCurrency($amount, $rates = null, $source = 'USD', $dest = 'GBP')
/home/hplex/live/wp-content/themes/lexicon/currency.php
$context['current_currency'] = $converter->currencyForCountry();
if (data_get($_REQUEST, 'currency')) {
    $context['current_currency'] = $_REQUEST['currency'];
}
 
if (data_get($_REQUEST, 'action') == 'muggle-to-wizard') {
    $context['action'] = 'muggle-to-wizard';
    $context['muggle'] = $_REQUEST['muggle'];
    $context['results'] = $results = $converter->muggleToWizard($_REQUEST['muggle'], $context['current_currency'], $date);
    $context['results_string'] = $converter->wizardCurrencyString($results);
    $context['galleons'] = $results['galleons'];
    $context['sickles'] = $results['sickles'];
    $context['knuts'] = $results['knuts'];
} elseif (data_get($_REQUEST, 'action') == 'wizard-to-muggle') {
    $context['action'] = 'wizard-to-muggle';
    $context['galleons'] = data_get($_REQUEST, 'galleons');
    $context['sickles'] = data_get($_REQUEST, 'sickles');
    $context['knuts'] = data_get($_REQUEST, 'knuts');
    $context['muggle'] = $converter->wizardToMuggle($context['galleons'], $context['sickles'], $context['knuts'], $context['current_currency'], $date);
    $context['wizard_string'] = $converter->wizardCurrencyString([
        'galleons' => $context['galleons'],
        'sickles' => $context['sickles'],
        'knuts' => $context['knuts']
    ]);
} elseif (data_get($_REQUEST, 'action') == 'general') {
    $context['action'] = 'general';
 
    try {
        $context['muggle'] = $_REQUEST['muggle'];
        $context['target_currency'] = $_REQUEST['target'];
        if (!$converter->isWizardCurrency($context['current_currency']) && !$converter->isWizardCurrency($context['target_currency'])) {
            throw new Exception("At least one of the currencies must be a Wizarding Currency.");
        }
 
        $context['result'] = $results = $converter->convertCurrency($context['muggle'], $context['rates'], $context['current_currency'], $context['target_currency']);
        $context['target_currency_label'] = $currencies[$context['target_currency']];
 
        if ($results != 1) {
            $context['target_currency_label'] = $inflector->pluralize($currencies[$context['target_currency']]);
        }
/home/hplex/live/www/wp-includes/template-loader.php
     */
    $template   = apply_filters( 'template_include', $template );
    $is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
    $template   = $is_stringy ? realpath( (string) $template ) : null;
    if (
        is_string( $template ) &&
        ( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&
        is_file( $template ) &&
        is_readable( $template )
    ) {
        /**
         * Fires immediately before including the template.
         *
         * @since 6.9.0
         *
         * @param string $template The path of the template about to be included.
         */
        do_action( 'wp_before_include_template', $template );
 
        include $template;
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
}
 
Arguments
  1. "/home/hplex/live/wp-content/themes/lexicon/currency.php"
    
/home/hplex/live/www/wp-blog-header.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. "/home/hplex/live/www/wp-includes/template-loader.php"
    
/home/hplex/live/www/index.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. "/home/hplex/live/www/wp-blog-header.php"
    

Environment & details:

Key Value
action
"wizard-to-muggle"
date
"1994-08-25"
galleons
"1¤cy=GBP"
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE
"nginx/1.28.3"
REQUEST_URI
"/currency/exchange/?action=wizard-to-muggle&date=1994-08-25&galleons=1%C2%A4cy%3DGBP"
USER
"www-data"
HOME
"/var/www"
HTTP_HOST
"www.hp-lexicon.org"
HTTP_X_FORWARDED_PROTO
"https"
HTTP_CF_VISITOR
"{\"scheme\":\"https\"}"
HTTP_CF_IPCOUNTRY
"US"
HTTP_CF_CONNECTING_IP
"216.73.216.212"
HTTP_CDN_LOOP
"cloudflare; loops=1"
HTTP_USER_AGENT
"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])"
HTTP_ACCEPT_ENCODING
"gzip, br"
HTTP_ACCEPT
"*/*"
HTTP_CF_RAY
"a3a845b6ab3cbde9-CMH"
HTTP_X_FORWARDED_FOR
"216.73.216.212"
REDIRECT_STATUS
"200"
SERVER_NAME
"www.hp-lexicon.org"
SERVER_PORT
"443"
SERVER_ADDR
"205.164.24.203"
REMOTE_USER
""
REMOTE_PORT
""
REMOTE_ADDR
"216.73.216.212"
GATEWAY_INTERFACE
"CGI/1.1"
HTTPS
"on"
REQUEST_SCHEME
"https"
SERVER_PROTOCOL
"HTTP/2.0"
DOCUMENT_ROOT
"/home/hplex/live/www"
DOCUMENT_URI
"/index.php"
SCRIPT_NAME
"/index.php"
CONTENT_LENGTH
""
CONTENT_TYPE
""
REQUEST_METHOD
"GET"
QUERY_STRING
"action=wizard-to-muggle&date=1994-08-25&galleons=1%C2%A4cy%3DGBP"
SCRIPT_FILENAME
"/home/hplex/live/www/index.php"
PATH_INFO
""
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1789314259.8795
REQUEST_TIME
1789314259
empty
0. Whoops\Handler\PrettyPageHandler