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

Fixed stdClass constructor call in mysql_fetch_object() #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lorenzos
Copy link

@lorenzos lorenzos commented Jan 21, 2022

Fixed error "stdClass does not have a constructor hence you cannot use ctor_params" (tested in PHP 7.0.33) when explicitly passing "stdClass" instead of null to mysql_fetch_object().

Fixed error "stdClass does not have a constructor hence you cannot use ctor_params" when explicitly passing `"stdClass"` instead of `null` to `mysql_fetch_object()`
@dshafik
Copy link
Owner

dshafik commented Jan 21, 2022

@lorenzos would this same issue occur for any class without a constructor? Perhaps the better option is to check method _exists($class, '__construct') and have an additional elseif that calls without the third param?

@dshafik
Copy link
Owner

dshafik commented Jan 21, 2022

@lorenzos also, and I can't stress this enough, PHP 7.0 has been without security fixes for three years. You should be using 7.4, 8.0, or 8.1. This library still works with those.

Fixed error "Class does not have a constructor hence you cannot use ctor_params" when passing a class name with no defined constructor to `mysql_fetch_object()`
@lorenzos
Copy link
Author

lorenzos commented Jan 21, 2022

@dshafik Yes, you're right, thanks 🙂 I removed the string check since it's not necessary anymore: it looks like method_exists() works just fine with stdClass, which is the default parameter value for mysqli_fetch_object() anyway.

@lorenzos
Copy link
Author

lorenzos commented Jan 21, 2022

PHP 7.0 has been without security fixes for three years. You should be using 7.4, 8.0, or 8.1. This library still works with those.

If it was up to me and my developer colleagues... Unfortunately that is one of those cases where, after informing them, there's not much you can do: the customer and his hosting provider don't want to understand it, or probably they just don't want to invest time or money on software migration. 🤷‍♂️

Thanks for the warning anyway, and thanks for being clear in the README too, I much appreciated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants