Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2021, 05:30 PM
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Location: Bremen/Germany
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 10-28-2021, 01:26 PM
shka shka is offline
 
Join Date: Mar 2016
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'?
Reply With Quote
Благодарность от:
BulliM
  #3  
Old 10-28-2021, 11:47 PM
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Location: Bremen/Germany
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for that. Will check that.

Quote:
Originally Posted by shka View Post
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.
Reply With Quote
  #4  
Old 10-29-2021, 05:41 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could use $val['assets'] directly in your if condition.
Reply With Quote
  #5  
Old 10-29-2021, 12:01 PM
BulliM's Avatar
BulliM BulliM is offline
 
Join Date: Oct 2017
Location: Bremen/Germany
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by delicjous View Post
You could use $val['assets'] directly in your if condition.
I tried yesterday, but this doesn't work.
Reply With Quote
  #6  
Old 10-30-2021, 03:10 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BulliM View Post
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04588 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete