riofriz / vcc_betterranks

phpBB extension to show every user banner on profile pages and viewtopics
GNU General Public License v2.0
0 stars 1 forks source link

PHP 8 shows warnings #3

Open ste101 opened 3 years ago

ste101 commented 3 years ago

[phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 193: Undefined array key 2 [phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 197: Undefined array key 2 [phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 168: Undefined array key 53 [phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 168: Undefined array key 52 [phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 168: Undefined array key 52 [phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 168: Undefined array key 52

B2K-GAMERS commented 1 month ago

Did this ever get fixed?

riofriz commented 1 month ago

Did this ever get fixed?

Hi! I forgot I ever built this to be honest with you 😆 I just merged the suggested pull request as it looks good, that should fix the warnings!

Sorry about that :)

B2K-GAMERS commented 1 month ago

Hi thanks for reaching out to me Been at it since I work up trying to get it to work lol but no luck. Just downloaded the new one But sadly I still got this ERROR. When I had the PHP 7.4 I wasnt getting this error message. But after update to PHP 8.3 I got these and cant go back to previous PHP version.

Someone said it’s not checking that the array key is set before trying to access it.

I am using PHPBB 3.3.12 PHP. 8.3

[phpBB Debug] PHP Warning: in file [ROOT]/ext/vcc/betterranks/event/listener.php on line 203: Undefined array key 2 [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4187: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3060) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4187: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3060) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4187: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3060) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4187: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3060)

On Sun, Aug 11, 2024 at 1:59 PM riofriz @.***> wrote:

Did this ever get fixed?

Hi! I forgot I ever built this to be honest with you 😆 I just merged the suggested pull request as it looks good, that should fix the warnings!

Sorry about that :)

— Reply to this email directly, view it on GitHub https://github.com/riofriz/vcc_betterranks/issues/3#issuecomment-2282856201, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJRXOXEMDICAJAHEF6UO6KTZQ6YBTAVCNFSM6AAAAABMK7JMPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSHA2TMMRQGE . You are receiving this because you commented.Message ID: @.***>

rmcgirr83 commented 1 month ago

Honestly this extension has more issues than that, eg in the ucp_banners_controller file there is this $updateBanners = 'UPDATE phpbb_user_group which is a complete no-no.

B2K-GAMERS commented 1 month ago

Honestly this extension has more issues than that, eg in the ucp_banners_controller file there is this $updateBanners = 'UPDATE phpbb_user_group which is a complete no-no.

Yea not sure why it is a No no. But that was causing the AJAX submit button to not work on mine. I had to change the prefix PHPBB to the one my board actually uses in order to get that part to work. But I’m guessing there’s a proper way to make it detect the correct prefix since I’m assuming other people can also have different prefix set for there board

riofriz commented 1 month ago

It's a no no because phpbb_ is hard coded there and should not be, as it's customisable, I assume..

The only reason why this is public is someone from my forum wanted to use it on theirs so I quickly made it available, it was built just to be used on my own board, so I didn't really bother with coding standards or conventions 😆

B2K-GAMERS commented 1 month ago

It's a no no because phpbb_ is hard coded there and should not be, as it's customisable, I assume..

The only reason why this is public is someone from my forum wanted to use it on theirs so I quickly made it available, it was built just to be used on my own board, so I didn't really bother with coding standards or conventions 😆

Oh okay. Well I appreciate you sharing it. I think it’s an awesome extension. Just wish I knew how to code like you guys. Been googling and searching but have no clue of what is needed to make that code check the array key is set before trying to access it. To get those error messages to go away :(

rmcgirr83 commented 1 month ago

Not to mention you're running a query in a loop in viewtopic and using undefined functions in the listener file. Not using append_sid for the memberlist link, etc. Needs quite a bit of work IMHO.

This should fix that error message 'GROUP' => !empty($rankString) ? $rankString[$niddle] : '',

B2K-GAMERS commented 1 month ago

Not to mention you're running a query in a loop in viewtopic and using undefined functions in the listener file. Not using append_sid for the memberlist link, etc. Needs quite a bit of work IMHO.

This should fix that error message 'GROUP' => !empty($rankString) ? $rankString[$niddle] : '',

Thanks man. Your the best. That fixed the Error message.

Also is there a website where you learn this coding? Or a class you took in college to get started to have an idea what things do.

rmcgirr83 commented 1 month ago

I learned by looking at code and a lot of reading on the PHP website.