vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   PHP 7 To PHP 8 Issue (https://vborg.vbsupport.ru/showthread.php?t=328939)

BulliM 10-27-2021 05:30 PM

PHP 7 To PHP 8 Issue
 
Since quite a while I get php 7.3 warnings in Nginx error.log:

Quote:

FastCGI sent in stderr: "PHP message: PHP Warning: Use of undefined constant assets - assumed 'assets' (this will throw an Error in a future version of PHP) in /var/www/*******/includes/vb5/template.php(404) : eval()'d code on line 256
As long as it works I ignored that. But when I update PHP to version 8, the sub site is no longer available. Seems that warning occurs an error now.

In my code I cannot find any error. The problem seems to result in a loop of my (simplified) code:

PHP Code:

foreach($variables as $variable)
{
    
$item vB::getDbAssertor()->getRow('APINAME:TABLENAME', array('FIELDNAME' => $variable));
    
$var[$i]['FIELD'][$y] = $item['FIELD'];


Don't really know, what php8 needs to work at this point. Has anyone an idea?

shka 10-28-2021 01:26 PM

https://www.php.net/manual/de/migrat...compatible.php

Code:

A number of warnings have been converted into Error exceptions:
    ...
    Attempting to access unqualified constants which are undefined. Previously, unqualified constant accesses resulted in a warning and were interpreted as strings.

Deine Variablenbezeichnungen sind grausam nichtssagend (var, variables, variable, y, i). Welche davon kann den Wert 'assets' annehmen?

Your variables are cruelly named. Which of them can get the value 'assets'?

BulliM 10-28-2021 11:47 PM

Quote:

Originally Posted by shka (Post 2607663)

Thanks for that. Will check that.

Quote:

Originally Posted by shka (Post 2607663)
Your variables are cruelly named. Which of them can get the value 'assets'?

Seems not important, because any line like...
PHP Code:

$var[$i]['FIELD'][$y] = $item['FIELD']; 

...in my code, results in this error.

Only if all those (five) lines excluded, my code is running. But probably these lines aren't the problem. At the moment I really don't know, what is going on.

--------------- Added [DATE]1635476154[/DATE] at [TIME]1635476154[/TIME] ---------------

SOLVED

I've solved that. Error was in template.

This code...
Code:

<vb:if condition="$val.assets >0">...</vb:if>
...results in that error.

I solved that by doing...

Code:

{vb:set assets, {vb:var val.assets}}
<vb:if condition="$assets >0">...</vb:if>

...what works with PHP8. I have no errors anymore. :)

delicjous 10-29-2021 05:41 AM

You could use $val['assets'] directly in your if condition.

BulliM 10-29-2021 12:01 PM

Quote:

Originally Posted by delicjous (Post 2607667)
You could use $val['assets'] directly in your if condition.

I tried yesterday, but this doesn't work.

delicjous 10-30-2021 03:10 AM

Quote:

Originally Posted by BulliM (Post 2607670)
I tried yesterday, but this doesn't work.

Dann wei? ich auch nicht?

Then shka is right and we need more input. But if it is working it is ok I think


All times are GMT. The time now is 10:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02133 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete