php7-mysql-shim icon indicating copy to clipboard operation
php7-mysql-shim copied to clipboard

Fixed stdClass constructor call in mysql_fetch_object()

Open lorenzos opened this issue 3 years ago • 4 comments
trafficstars

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().

lorenzos avatar Jan 21 '22 10:01 lorenzos

@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 avatar Jan 21 '22 11:01 dshafik

@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.

dshafik avatar Jan 21 '22 11:01 dshafik

@dshafik Yes, you're right, thanks :slightly_smiling_face: 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 avatar Jan 21 '22 14:01 lorenzos

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. :man_shrugging:

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

lorenzos avatar Jan 21 '22 15:01 lorenzos