Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Thor1423 opened this issue May 8, 2024 · 10 comments
Open

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

Thor1423 opened this issue May 8, 2024 · 10 comments
Labels
Bug i broke something

Comments

@Thor1423
Copy link

Thor1423 commented May 8, 2024

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.

  • OS: Linux Debian
  • PHP version: 8.3.x
  • revision used: Latest from here
  • AzerothCore: no i have TC Core
@peycho
Copy link

peycho commented May 8, 2024

My temporary solution works:
TrinityCore#46

@Thor1423
Copy link
Author

Thor1423 commented May 8, 2024

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
Copy link
Owner

Sarjuuk commented May 8, 2024

Another solution available?

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

@Thor1423
Copy link
Author

Thor1423 commented May 8, 2024

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
Copy link
Owner

Sarjuuk commented May 9, 2024

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
Copy link
Author

Thor1423 commented May 9, 2024

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
Copy link
Owner

Sarjuuk commented May 9, 2024

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.

@Sarjuuk Sarjuuk added the Bug i broke something label May 9, 2024
@Sarjuuk Sarjuuk changed the title error with SqlGen::generate() - filling aowow_item_stats with data error - string in number_format() in sqlgen item_stats May 9, 2024
@Thor1423
Copy link
Author

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
Copy link

peycho commented May 11, 2024

@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
Copy link
Author

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

Thank you, that worked.

@Thor1423 Thor1423 reopened this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug i broke something
Projects
None yet
Development

No branches or pull requests

3 participants