PHP Classes

39 errors in a single file

Recommend this page to a friend!

      Metabase  >  All threads  >  39 errors in a single file  >  (Un) Subscribe thread alerts  
Subject:39 errors in a single file
Summary:Package rating comment
Messages:7
Author:Dharman
Date:2021-10-18 14:45:15
 

Dharman rated this package as follows:

Utility: Bad
Consistency: Bad
Documentation: Bad
Examples: Bad
Unit tests: Bad

  1. 39 errors in a single file   Reply   Report abuse  
Picture of Dharman Dharman - 2021-10-18 14:45:15
39 errors in a single file

  2. Re: 39 errors in a single file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-10-18 15:26:11 - In reply to message 1 from Dharman
Hello Dharman,

Which version of PHP are you using?

  3. Re: 39 errors in a single file   Reply   Report abuse  
Picture of Dharman Dharman - 2021-10-18 15:56:21 - In reply to message 2 from Manuel Lemos
The errors aren't related to any version. I am talking about general PHP errors. Non-existent functions, undefined variables, wrong arguments. count() on integers instead of arrays. All I had to do was to open a single file in an IDE and it highlighted 39 errors.

  4. Re: 39 errors in a single file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-10-19 06:49:26 - In reply to message 3 from Dharman
Thank you for your feedback.

It seems you are trying to evaluate the package in a way that is different from what you can see in the example scripts. I mean as a library of class and script files that work together.

Let's work together to learn how to improve the package to avoid the undesired effect you see.

What is the name of the file that you opened in your IDE?

  5. Re: 39 errors in a single file   Reply   Report abuse  
Picture of Dharman Dharman - 2021-10-19 09:57:10 - In reply to message 4 from Manuel Lemos
This code definitely does not work. I don't need to execute it to see that it has tons of problems.

I opened manager_mysqli.php but almost every file that I open has a lot of issues. Just take a look at this screenshot https://i.imgur.com/P965d7k.png
I use VS Code, but if you use PHPStorm then it should also highlight these issues for you.

On top of that, the codebase suffers from poor formatting and naming conventions and outdated practices. I assume the idea was to provide some kind of unified support for legacy projects as I can't see PDO in this project. But even for a legacy project, there are too many issues here to enumerate. I am not even mentioning potential SQL injection.

Issues:
- non-existent functions
- undefined variables
- wrong parameters to standard functions
- high cyclomatic complexity
- poor formatting
- poor naming
- lack of prepared statements/parameterization
- error suppression
- lack of type safety/type declarations
- dead code/commented out code
- lack of unit testing

This code will never do what it was designed to do. I am not interested in fixing this as realistically, one would have to scrap this project and start over to do it properly. If you are still maintaining it you can try to fix some issues and make sure that code at least works. Any proper IDE should highlight the main issues for you, but I encourage you to use code-style fixer/checker and static analysers. They will help you fix the project as much as possible.

  6. Re: 39 errors in a single file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-10-19 21:48:14 - In reply to message 5 from Dharman
Hello Dharman,

Thank you again for your feedback.

Just for clarification purposes, the code file that you tried should be run together with other code of the same package.

It is a sub-class of another class. So it only makes sense to analyze this class file when you also analyze the parent class.

I can only evaluate if the code works when I try to run it in practice.

The code seems to use an old-style to make sure it is compatible with many versions of PHP including the latest.

Actually, the code that you see is powering the PHP Classes site.

I can understand that you prefer a different style of programming. I respect that.

Usually, I do not use those IDEs because I have simpler needs that allow me to be more productive.

Anyway, when I have more time I will try them just to see what they suggest that can be improved in this package.

Thank you again for your collaboration.

  7. Re: 39 errors in a single file   Reply   Report abuse  
Picture of James James - 2021-10-26 14:16:10 - In reply to message 5 from Dharman
I disagree. This class works perfectly, and has a 15 year track record.

Spewing nonsense your IDE is puking, and saying the code doesn't work only shows that you don't have the knowledge needed to use it.