Sarjuuk / aowow

Database viewer for TrinityCore based on aowow by @LordJZ, based on the JS-Engine of Wowhead
204 stars 217 forks source link

error - string in number_format() in sqlgen item_stats #411

Closed Thor1423 closed 3 months ago

Thor1423 commented 4 months ago
01:17:45          SqlGen::generate() - filling aowow_item_stats with data
01:17:45           - applying stats for enchantments
01:17:47             2656 enchantments parsed
01:17:47           - applying stats for items
01:18:30           * batch #28 (1000)
Exception - number_format(): Argument #1 ($num) must be of type int|float, string given
   setup/tools/sqlgen/item_stats.func.php(112)
#0 setup/tools/sqlgen/item_stats.func.php(112): number_format()
#1 setup/tools/sqlgen/item_stats.func.php(266): ItemStatSetup->writeStatsTable()
#2 setup/tools/sqlGen.class.php(239): SetupScript@anonymous->generate()
#3 setup/tools/clisetup/setup.func.php(300): SqlGen::generate()
#4 setup/setup.php(40): setup()
#5 aowow(10): require('...')
#6 {main}

Where is the error and how can I fix it? I've restarted the setup several times now, but it always hangs at this point.

peycho commented 4 months ago

My temporary solution works: https://github.com/TrinityCore/aowow/issues/46

Thor1423 commented 4 months ago

My temporary solution works: TrinityCore#46

@peycho

I've built your workaround into the item_stats.func.php file, but I still get this error.

Another solution available?

Sarjuuk commented 4 months ago

Another solution available?

no, just add the two (float) for the time being

Thor1423 commented 4 months ago

Another solution available?

no, just add the two (float) for the time being

I don't really understand that now. I copied and pasted the workaround and the same error occurs.

I don't really understand what you're writing now.

Sarjuuk commented 4 months ago

So, the error message you received pointed you at the exact line in the exact file and named the function on that line where the error occurs. peycho then provided you with a ready to use sollution for this issue.

If you lack the basic programming knowledge to act on the provided info and are unwilling to acquire it, then this project isn't for you. There WILL be bugs in the future and i WILL be unable to fix them in a timely fashion. You will need to be able to help yourself!

Thor1423 commented 4 months ago

So, the error message you received pointed you at the exact line in the exact file and named the function on that line where the error occurs. peycho then provided you with a ready to use sollution for this issue.

If you lack the basic programming knowledge to act on the provided info and are unwilling to acquire it, then this project isn't for you. There WILL be bugs in the future and i WILL be unable to fix them in a timely fashion. You will need to be able to help yourself!

Unfortunately my knowledge is somewhat limited and I installed the workaround, but unfortunately without success.

You are the developer of this project and have better knowledge about it than I do. As a user, I can only report bugs that would then have to be fixed by the project developer.

It would be the same as if Windows had problems and you reported the bug and Microsoft told users to solve the problem themselves if workarounds didn't work for everyone.

I don't want to sound rude, but it's not my job to fix the bugs, it's the developer of the code who understands the code better than someone who downloads the program and tries to install it according to the instructions.

Not everyone knows anything about programming.

Sarjuuk commented 4 months ago

It would be the same as if Windows had problems and you reported the bug and Microsoft told users to solve the problem themselves if workarounds didn't work for everyone.

Well no. You (supposedly) paid for Windows and are entitled to some amount of support. I'm not even claiming everything to be in working order. Hell, i'm not even really adervtising the existens of this project. This issue tracker doen't exist because i >have< to help you, but because >i myself want< my project to be in working order .. however long that may take.

I don't want to sound rude, but it's not my job to fix the bugs, it's the developer of the code who understands the code better than someone who downloads the program and tries to install it according to the instructions.

You are not rude, but it also isn't my job >job< to maintain this project. It's my silly little brain exercise. An outlet for maintaining my proficiency with php. I do try to keep it in working order, but well, here we are.

Not everyone knows anything about programming.

Sure, but you just entered a field where it is all but required. (Also i could have sworn TC once had a text blob explaining itself as an educational project first. Or maybe that was MaNGOS.)

In any case, you have two options. 1) Learn, and apply peychos patch yourself. (and as far as programming goes this one is easy, trust me) 2) Wait ... an indeterminate amount of time.

Thor1423 commented 4 months ago

It would be the same as if Windows had problems and you reported the bug and Microsoft told users to solve the problem themselves if workarounds didn't work for everyone.

Well no. You (supposedly) paid for Windows and are entitled to some amount of support. I'm not even claiming everything to be in working order. Hell, i'm not even really adervtising the existens of this project. This issue tracker doen't exist because i >have< to help you, but because >i myself want< my project to be in working order .. however long that may take.

I don't want to sound rude, but it's not my job to fix the bugs, it's the developer of the code who understands the code better than someone who downloads the program and tries to install it according to the instructions.

You are not rude, but it also isn't my job >job< to maintain this project. It's my silly little brain exercise. An outlet for maintaining my proficiency with php. I do try to keep it in working order, but well, here we are.

Not everyone knows anything about programming.

Sure, but you just entered a field where it is all but required. (Also i could have sworn TC once had a text blob explaining itself as an educational project first. Or maybe that was MaNGOS.)

In any case, you have two options.

1. Learn, and apply peychos patch yourself. (and as far as programming goes this one is easy, trust me)

2. Wait ... an indeterminate amount of time.

The Windows thing was a stupid example. The same can also be done on Linux distributions, a free operating system. And people use this bug tracker to report bugs that they can't fix themselves.

Now I'm approaching 50 and it's difficult for me to learn anything new. In my younger years and with a lot of time, that might have been possible.

And I inserted the patch/workaround into the file where the code snippet appears. I'd like to attach this file here so you can see that I installed it, but the error still exists.

I attached the file in question as a text file because you can't upload php files and you can see I applied the patch from the user, but if the error continues to appear there's nothing I can do about it.

item_stats.func.txt

peycho commented 4 months ago

@Thor1423 there are two lines in that function that needs to be "fixed".

  1. Line 112 in setup/tools/sqlgen/item_stats.func.php Change:
    $updateFields[$k] = number_format($v, 2, '.', '');
    $updateFields[$k] = number_format((float)$v, 2, '.', '');

    The next line is just 10 lines below. Change

    $updateFields[$str] = number_format($v, 2, '.', '');

    to

    $updateFields[$str] = number_format((float)$v, 2, '.', '');

    As @Sarjuuk mentioned this is just a temporary fix and it's not added because the whole part of this setup is about to be rewritten as a whole.

Thor1423 commented 4 months ago

@peycho Thank you very much, that's it. I copied and pasted the code, but something was still missing.

Thank you, that worked.

Sarjuuk commented 3 months ago

error source removed in d16b08bb297dd1522040a01d1ba8958fba52d155