XF 2.2 Template error: [E_WARNING] A non-numeric value encountered

Nirjonadda

Well-known member
I am getting Server error log after upgraded to PHP 8 from 7.4 that causes a PHP 8 incompatibility error.

Code:
ErrorException: Template error: [E_WARNING] A non-numeric value encountered internal_data/code_cache/templates/l1/s12/public/extra.less.php:99

Generated by: Unknown account Jul 17, 2021 at 12:36 AM

Stack trace

#0 internal_data/code_cache/templates/l1/s12/public/extra.less.php(99): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] A n...', '/home/nadda/pub...', 99)
#1 src/XF/Template/Templater.php(1644): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\XF22\Templater), Array, NULL)
#2 src/addons/MaZ/AMP/XF/Template/XF22/Templater.php(52): XF\Template\Templater->renderTemplate('extra.less', Array, false, NULL)
#3 src/XF/CssRenderer.php(331): MaZ\AMP\XF\Template\XF22\Templater->renderTemplate('public:extra.le...', Array, false)
#4 src/XF/CssRenderer.php(258): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#5 src/addons/ThemeHouse/UIX/XF/CssRenderer.php(40): XF\CssRenderer->renderTemplates(Array, Array, Array)
#6 src/XF/CssRenderer.php(116): ThemeHouse\UIX\XF\CssRenderer->renderTemplates(Array, Array, Array)
#7 src/XF/CssWriter.php(53): XF\CssRenderer->render(Array)
#8 src/addons/SV/RedisCache/XF/CssWriter.php(52): XF\CssWriter->run(Array, 12, 1, '9be90d36415bf53...')
#9 css.php(30): SV\RedisCache\XF\CssWriter->run(Array, 12, 1, '9be90d36415bf53...')
#10 {main}

Request state

array(4) {
  ["url"] => string(1183) "/css.php?css=public%3Aaf_as_message_postbit.less%2Cpublic%3Aallm_tag_check_post_links_status.less%2Cpublic%3Aaloph_op_ribbon_style.less%2Cpublic%3Abssp_bootstrap_datetimepicker.less%2Cpublic%3Abssp_schedule.less%2Cpublic%3Acarousel.less%2Cpublic%3AcontentCopyProtection.less%2Cpublic%3AcontentCopyProtection_quote_bbcode.less%2Cpublic%3AcontentCopyProtection_url_bbcode.less%2Cpublic%3Adbtech_shop.less%2Cpublic%3Adbtech_shop_postbit.less%2Cpublic%3Aeditor.less%2Cpublic%3Akl_em_editor_templates.less%2Cpublic%3Akl_em_froala_fullscreen.less%2Cpublic%3Akl_em_froala_image.less%2Cpublic%3Akl_em_froala_special_characters.less%2Cpublic%3Alightslider.less%2Cpublic%3Amessage.less%2Cpublic%3Anotices.less%2Cpublic%3Ashare_controls.less%2Cpublic%3Asiropu_ads_manager_ad.less%2Cpublic%3Asnog_flags.less%2Cpublic%3Astructured_list.less%2Cpublic%3AsvAdvancedBBCode_wordcount.less%2Cpublic%3AsvESE_autocomplete.less%2Cpublic%3AsvLazyImageLoader.less%2Cpublic%3Asv_bbcode_spoiler.less%2Cpublic%3Ath_covers.less%2Cpublic%3Ath_uix_threadStarterPost.less%2Cpublic%3Athfilters_node_label.less%2Cpublic%3Axb.less%2Cpublic%3Aextra.less&s=12&l=1&d=1626451819&k=9be90d36415bf53b92a19384d0c130ff164c7713"
  ["referrer"] => string(37) "/threads/47120/"
  ["_GET"] => array(5) {
    ["css"] => string(979) "public:af_as_message_postbit.less,public:allm_tag_check_post_links_status.less,public:aloph_op_ribbon_style.less,public:bssp_bootstrap_datetimepicker.less,public:bssp_schedule.less,public:carousel.less,public:contentCopyProtection.less,public:contentCopyProtection_quote_bbcode.less,public:contentCopyProtection_url_bbcode.less,public:dbtech_shop.less,public:dbtech_shop_postbit.less,public:editor.less,public:kl_em_editor_templates.less,public:kl_em_froala_fullscreen.less,public:kl_em_froala_image.less,public:kl_em_froala_special_characters.less,public:lightslider.less,public:message.less,public:notices.less,public:share_controls.less,public:siropu_ads_manager_ad.less,public:snog_flags.less,public:structured_list.less,public:svAdvancedBBCode_wordcount.less,public:svESE_autocomplete.less,public:svLazyImageLoader.less,public:sv_bbcode_spoiler.less,public:th_covers.less,public:th_uix_threadStarterPost.less,public:thfilters_node_label.less,public:xb.less,public:extra.less"
    ["s"] => string(2) "12"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1626451819"
    ["k"] => string(40) "9be90d36415bf53b92a19384d0c130ff164c7713"
  }
  ["_POST"] => array(0) {
  }
}

Code:
ErrorException: Template error: [E_WARNING] A non-numeric value encountered internal_data/code_cache/templates/l1/s2/public/extra.less.php:156

Generated by: Unknown account Jul 17, 2021 at 12:41 AM

Stack trace

#0 internal_data/code_cache/templates/l1/s2/public/extra.less.php(156): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] A n...', '/home/nadda/pub...', 156)
#1 src/XF/Template/Templater.php(1644): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\XF22\Templater), Array, NULL)
#2 src/addons/MaZ/AMP/XF/Template/XF22/Templater.php(52): XF\Template\Templater->renderTemplate('extra.less', Array, false, NULL)
#3 src/XF/CssRenderer.php(331): MaZ\AMP\XF\Template\XF22\Templater->renderTemplate('public:extra.le...', Array, false)
#4 src/XF/CssRenderer.php(258): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#5 src/addons/ThemeHouse/UIX/XF/CssRenderer.php(40): XF\CssRenderer->renderTemplates(Array, Array, Array)
#6 src/XF/CssRenderer.php(116): ThemeHouse\UIX\XF\CssRenderer->renderTemplates(Array, Array, Array)
#7 src/XF/CssWriter.php(53): XF\CssRenderer->render(Array)
#8 src/addons/SV/RedisCache/XF/CssWriter.php(52): XF\CssWriter->run(Array, 2, 1, 'f5141e13a57ffd7...')
#9 css.php(30): SV\RedisCache\XF\CssWriter->run(Array, 2, 1, 'f5141e13a57ffd7...')
#10 {main}

Request state

array(4) {
  ["url"] => string(752) "/css.php?css=public%3Aattachments.less%2Cpublic%3Abssp_bootstrap_datetimepicker.less%2Cpublic%3Abssp_schedule.less%2Cpublic%3Adbtech_shop.less%2Cpublic%3Adbtech_shop_item_grid.less%2Cpublic%3Aeditor.less%2Cpublic%3Akl_em_editor_templates.less%2Cpublic%3Akl_em_froala_fullscreen.less%2Cpublic%3Akl_em_froala_image.less%2Cpublic%3Akl_em_froala_special_characters.less%2Cpublic%3Alightbox.less%2Cpublic%3Amessage.less%2Cpublic%3Anode_list.less%2Cpublic%3Anotices.less%2Cpublic%3Arating_stars.less%2Cpublic%3Astructured_list.less%2Cpublic%3AsvAdvancedBBCode_wordcount.less%2Cpublic%3AsvESE_autocomplete.less%2Cpublic%3Ath_covers.less%2Cpublic%3Athfilters_node_label.less%2Cpublic%3Aextra.less&s=2&l=1&d=1626451819&k=f5141e13a57ffd77cf773fb2a8bda30fa97f259b"
  ["referrer"] => string(33) "/whats-new/"
  ["_GET"] => array(5) {
    ["css"] => string(593) "public:attachments.less,public:bssp_bootstrap_datetimepicker.less,public:bssp_schedule.less,public:dbtech_shop.less,public:dbtech_shop_item_grid.less,public:editor.less,public:kl_em_editor_templates.less,public:kl_em_froala_fullscreen.less,public:kl_em_froala_image.less,public:kl_em_froala_special_characters.less,public:lightbox.less,public:message.less,public:node_list.less,public:notices.less,public:rating_stars.less,public:structured_list.less,public:svAdvancedBBCode_wordcount.less,public:svESE_autocomplete.less,public:th_covers.less,public:thfilters_node_label.less,public:extra.less"
    ["s"] => string(1) "2"
    ["l"] => string(1) "1"
    ["d"] => string(10) "1626451819"
    ["k"] => string(40) "f5141e13a57ffd77cf773fb2a8bda30fa97f259b"
  }
  ["_POST"] => array(0) {
  }
}
 

Chris D

XenForo developer
Staff member
It seems to be related to content in your extra.less template.

PHP 8.0 is stricter with certain value types so an error isn't totally unexpected though if you can pinpoint the specific problematic code (it may be close to line 99, though the line numbers in the compiled template aren't always 1:1) then we can give advice on that.
 

Nirjonadda

Well-known member
@Chris D This my extra.less template.


Code:
{{ include('xenfocus_base.less') }}
{{ include('xenfocus_theme.less') }}

// Place your custom code below

/* I-Line BBCode */
.bbCodeInline{ font-size: inherit; }

/* Navigation icons START */
<xf:if is="property('xenfocus_navIcons')">
  .focus-wrap-nav .p-navEl-link,.offCanvasMenu-linkHolder .offCanvasMenu-link[data-nav-id]{
    &[data-nav-id="imagehost"]:before{ content: '\f093'; }
    &[data-nav-id="snog_forms_nav"]:before{ content: '\f0fe'; }
    &[data-nav-id="dbtechShop"]:before{ content: '\f217'; }
    &[data-nav-id="th_donate"]:before{ content: '\f155'; }
    &[data-nav-id="addonFlarePubAwards"]:before{ content: '\f091'; }
  }
</xf:if>
/* Navigation icons END */

/* Original Poster Highlight */
div.ribbonBox .ribbon-wrapper{ z-index: 1; }

.reactions-left > ul { flex-wrap: wrap; }

.xenfocus-social a{ min-width: 40px; }
.xenfocus-social a:before{ display: block; flex: 0 0 auto; }

/* Remove show open new Tab button from Lightbox */
#lg-new-window {
    display: none !important;
}

/* Enable Sub-Navigation without drop down */
@focus-dropdown-nav: false;

/* Sticky Sidebar for Top Posters of the Month */
<xf:if is="property('ss_sidebar') == 'enabled'">
@media (min-width: @xf-responsiveMedium) {
    [data-template="tpm_list"] .stickySidebar {
        position: -webkit-sticky;
        position: sticky;
        top: calc(47px + @{xf-ss_top});
    }
}
</xf:if>

/* Medal show in center for post message */
ul.bdMedal_userMedals { text-align: center; }

/* Hide Medals show post message from mobile view */
@media (max-width: 650px) { ul.bdMedal_userMedals { display: none; } }

.message-userExtras { text-align: center; }

/* Google Search icon show */
button.button--primary.google-search-button .button-text
{
    padding-left: 0;
}

@media (min-width: (@xf-responsiveMedium + 1px)){
    .block--similarContents .structItem{
        display: table;
    }
}

/* Holidays Breadcrumb navigation long space */
.th_holiday__categoryStrip__left,
.th_holiday__categoryStrip__center,
.th_holiday__categoryStrip__right{
display: none;
}

/* Change the font size for Paid Registrations accountype IDs: 4 */
div.accountType[data-id="4"] div.price
{
    font-size: .85em;
}

/* Font Awesome icon Display in ads manager keyword link */
.keywordLink
{
    color: green;
    font-weight: bold;
    text-transform: uppercase;
}
.keywordLink:before
{
    .m-faBase();
    .m-faContent(@fa-var-link);
    margin-left: 5px;
}

/* Notice Display Styling */
.cxf-notice {
    color: #aa6709;
    background: #fff4e5;
    border-left: 3px solid #f2930d;
    text-align: left;
    position: relative;
    padding-left: 3em;
    min-height: 4em;

    &:before {
        .m-faBase();
        .m-faContent(@fa-var-exclamation-circle);
        color: #f2930d;
        font-size: 280%;
        position: absolute;
        top: 0;
        left: 6px;
    }
}

/* Add Widgets icon - Start */
.block-minorHeader::before{

    .block[data-widget-definition="eae_highlight_groups"] &{
        .m-faContent(@fa-var-user-secret);
    }
    
    .block[data-widget-definition="member_stat"] &{
        .m-faContent(@fa-var-trophy);
    }
    
        .block[data-widget-definition="thdonate_campaign"] &{
        .m-faContent(@fa-var-hand-holding-usd);
    }
    
        .block[data-widget-definition="snog_stylestats"] &{
        .m-faContent(@fa-var-star-half-alt);
    }
    
        .block[data-widget-definition="tpm_widget"] &{
        .m-faContent(@fa-var-user-graduate);
    }
    
}
/* Add Widgets icon - End */

/* Individual Boxed for Shop Gift START */
.message-userExtras dl, .dbtechShopPostbit.dbtechShopPostbit-items
{
    background-color: @xf-contentBg;
    padding: @xf-paddingSmall @xf-paddingMedium;
    border: 1px solid @xf-borderColor;
    border-radius: @xf-borderRadiusMedium;
    margin-bottom: 3px;
}
/* Individual Boxed for Shop Gift END */

/* Bottom border to the editor toolbar */
.fr-box.fr-basic {
    border: 1px solid @xf-borderColorLight;
}

.fr-box.fr-basic .fr-toolbar.fr-top {
    border-bottom: 1px solid @xf-borderColorLight;
}

.fr-toolbar .fr-btn-grp.rte-tab--inactive {
    border-bottom-width: 0px;
    border-left: 1px solid @xf-borderColorLight;
}
/* Bottom border to the editor toolbar */

/* Hide postbit moods for mobile browser */
@media (max-width: @xf-messageSingleColumnWidth)
{
    .afMood--postbit
    {
        display: none;
    }
}
/* Hide postbit moods for mobile browser */
 

mcatze

Well-known member
The issue is pretty clear. A non-numeric value encountered in extra.less

So you have a property that should have a numeric value with a non-numeric value. You can work with the browser dev tools to look for errors or missing values.
 

Nirjonadda

Well-known member
The issue is pretty clear. A non-numeric value encountered in extra.less

So you have a property that should have a numeric value with a non-numeric value. You can work with the browser dev tools to look for errors or missing values.

Does not find out any error in browser dev tools.
 
Top