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

Driver ErrorNo method causes process kill #254

Closed
3b-fly opened this issue Jun 2, 2016 · 3 comments
Closed

Driver ErrorNo method causes process kill #254

3b-fly opened this issue Jun 2, 2016 · 3 comments
Labels
bug mysqli MySQL and compatible drivers (MariaDB, etc) (Tier 1)
Milestone

Comments

@3b-fly
Copy link

3b-fly commented Jun 2, 2016

If mysqli type is used and mysqli extension is not loaded, connection ErrorNo method is called but it is overriden by mysqli ErrorNo method which calls mysqli extension functions. It ends with process kill with no exception.

@dregad dregad added bug mysqli MySQL and compatible drivers (MariaDB, etc) (Tier 1) labels Jun 3, 2016
@dregad
Copy link
Member

dregad commented Jun 3, 2016

Does this occur when using adodb-exceptions ?

@dregad
Copy link
Member

dregad commented Jun 3, 2016

I managed to reproduce the problem using exceptions

<?php
include('adodb.inc.php');
include('adodb-exceptions.inc.php');
$db = ADONewConnection('mysqli');
$db->connect('localhost', 'username', 'password', 'database') or die('ARGH');

PHP dies with fatal error.

@dregad dregad added this to the v5.20.5 milestone Jun 3, 2016
@3b-fly
Copy link
Author

3b-fly commented Jun 3, 2016

It does die without any error even with adodb-exceptions included in v5.20.4 - PHP 5.2.4.

dregad added a commit that referenced this issue Aug 10, 2016
When connecting to a database using mysqli driver and the corresponding
PHP extension is extension is not loaded, ADOdb dies with exit code 255
signaling a fatal error. This is due to ADODB_mysqli::ErrorNo() calling
mysqli_connect_errno() with the '@' operator, suppressing the 'Call to
undefined function' fatal error.

When not using adodb-exceptions, setting `$db->debug=true;` causes ADOdb
to print message 'Missing extension for mysql', but this is not the case
when exceptions are used.

To fix the problem, we only call the ErrorNo() method when the result of
_connect() is set, and otherwise pass arbitrary error number 0 with the
missing extension message to the exception handler.

Fixes #254
@dregad dregad closed this as completed Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mysqli MySQL and compatible drivers (MariaDB, etc) (Tier 1)
Projects
None yet
Development

No branches or pull requests

2 participants