[3.2][3.3][BETA] Popup PM

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

Table phpbb_users
user_avatar - not an empty string
user_avatar_height - empty string or 0
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

Татьяна5 wrote: Mon Dec 13, 2021 6:37 pm ...
Someone has an avatar set but its height is zero. This cannot be, this is an error in the database.
In any case it can be avoided I think, such an error. Like providing a fallback.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

3Di, it isn't right, for my opinion
If, according to the phpBB logic, there is an error in the database, then it should be visible
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

Different points of view, I prefer to avoid blocking the board (especially in production) but have a fallback and write a log. And really, a fallback here is very simple, you know.

Never, in my opinion blocking a board is a good decision, then leave the phpBB "logic" alone, if you have problems open an issue in the tracker.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

This is not an extension problem, nor is it a phpBB problem. This is a random bug in the database.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

I'm sure it's not a problem for you to provide a fallback, it seems pointless to argue about it, I guess.
After all, it's your code and I was just expressing my thoughts. Merry Christmas.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][BETA] Popup PM

Post by HaioPaio »

There are indeed a number of users in my database with an widht and height entry of zero, while the avatar is properly loaded and displayed. So, the error message did help me in this specific case to identify a hidden problem im my database.

I have opened a separate topic for my database problem here viewtopic.php?f=661&t=2609321.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

HaioPaio wrote: Tue Dec 14, 2021 10:19 am There are indeed a number of users in my database with an widht and height entry of zero
That's perfectly fine as per https://github.com/phpbb/phpbb/blob/dc9 ... 1051-L1052

The issue here is how the maths are done.
Avoiding a "division by zero" is something I personally faced a bunch of times, BTW.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

HaioPaio wrote: Tue Dec 14, 2021 10:19 am ...
I have opened a separate topic for my database problem here viewtopic.php?f=661&t=2609321.
As I said in that topic, you do not have problems with your DB.

You are confusing user_avatar_type and user_avatar with user_avatar_width and user_avatar_height ... somehow, IMHO.

Those are different kind of fields, each of them has a different function. Do not worry. ;)

The issue is here: https://github.com/Tatiana5/popuppm/blo ... #L131-L133

The fix is simple, but I do not want to interfere.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][BETA] Popup PM

Post by HaioPaio »

3DI
I agree. A value of 0 for avatar width and height in the database is not a malfunction.

Tatiana5
Your code is throwing an error while those database fields are allowed to be zero without disturbing anything.
I suggest to consider this in your code.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

It is nice to see that someone listens to me and evaluates my answers for what they technically offer, I hardly ever speak out of turn, especially on codes. Although I remain a hobbyist, I think I know what I'm talking about.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

upload

Code: Select all

'avatar_height' => $file->get('height'),
remote

Code: Select all

if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false))
		{
			$error[] = 'UNABLE_GET_IMAGE_SIZE';
			return false;
		}
local

Code: Select all

$dims = $this->imagesize->getImageSize($file_path . '/' . $image);
gravatar

Code: Select all

if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false))
			{
				$error[] = 'UNABLE_GET_IMAGE_SIZE';
				return false;
			}
Where is the value 0 possible? I have doubts only about local ones, and then there should not be zero
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

3Di wrote: Tue Dec 14, 2021 10:40 am
HaioPaio wrote: Tue Dec 14, 2021 10:19 am There are indeed a number of users in my database with an widht and height entry of zero
That's perfectly fine as per https://github.com/phpbb/phpbb/blob/dc9 ... 1051-L1052

The issue here is how the maths are done.
Avoiding a "division by zero" is something I personally faced a bunch of times, BTW.
The default value, 0, can be set if the user_avatar is empty
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: [3.2][3.3][BETA] Popup PM

Post by 3Di »

Татьяна5 wrote: Tue Dec 14, 2021 1:32 pm The default value, 0, can be set if the user_avatar is empty
You are missing the obvious, ZERO is the default value for anyone since the phpBB is installed, vanilla.
Since phpBB Olympus (3.0.0), to be exact.

The problem is here: https://github.com/Tatiana5/popuppm/blo ... #L131-L133

Especially line 131 IMHO
Last edited by 3Di on Tue Dec 14, 2021 1:39 pm, edited 1 time in total.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Татьяна5
Registered User
Posts: 192
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: [3.2][3.3][BETA] Popup PM

Post by Татьяна5 »

line 129

Code: Select all

if ($row['user_avatar'])
I think this is enough. Zero value when the field is filled is not provided by phpBB, if everything goes without errors

Return to “Extensions in Development”