● Clock block re-updated

Wed Feb 01, 2023 4:50 pm
Clan Leader
Top Dog
Nuke Dev / Coder
3029 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 32.4hrs.
Total Played: 62hrs.


  
Is this your job?
Reputation: 7363.5
votes: 7
Okay, just a heads-up to those of you using my clock block, a small update has been made to the block. I was told that php8 and debug is throwing errors. I have not tested it, but to fix it is simple. For both the 12 hour and 24 hour were slightly different by one had 2 small fixes where one of them required only 1 fix. All you need to do is download the blocks again, and just upload the following from the file:

public_html/blocks/block-Digital_Clock.php

That is the only file.

I'm not sure why it is doing what it should be, because technically what is done is not wrong and is actually valid, so it might be something new that changed with PHP 8.

Download Link:
Please login to see this link
Get registered or Log in


Expand
Thu Feb 02, 2023 5:29 am
Nuke Dev / Coder
101 Posts
Lonestar
Currently Offline
Offline

Most Played:
This week: 17.3hrs.
Total Played: 978hrs.


  
Must be married.
Reputation: 769.7
Expand

Re-add the "." to the start of the variable call, and then open your "config.php" and turn debug to "false", you will see the error it is throwing, like shown above.

I am not sure why the debug value is reversed, will have to look at that.


Expand
Thu Feb 02, 2023 10:34 am
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3029 Posts
coRpSE
Currently Offline
Offline

Most Played:
This week: 32.4hrs.
Total Played: 62hrs.


  
Is this your job?
Reputation: 7363.5
votes: 7
I see that, but like I said, uninitialized variables are technically not wrong and are actually valid. I feel this debate is like the whole inline style debate. Some people saying inline styles wrong and nobody should ever use it, and then others saying that it's fine in case specific needs.

Straight from PHP.net:
Uninitialized variables have a default value of their type depending on the context in which they are used - booleans default to false, integers and floats default to zero, strings (e.g. used in echo) are set as an empty string and arrays become to an empty array.


But they do say as of PHP8 there is an E_WARNING level error. Overall, the error is thrown not to say that it's wrong, but more of a warning saying that there is a variable that is undefined, and if you include another file with that same variable, that it may lead to unpredictable results.


 
Forums ©