consolibyte / quickbooks-php

QuickBooks Integration for PHP
Eclipse Public License 1.0
458 stars 338 forks source link

PHP 7 Issues #228

Open benhadad opened 5 years ago

benhadad commented 5 years ago

Seems the PHP kit is not ready for PHP7 Known issues Mysql calls not using Mysqli

mcrypt deprecated

issues with Composer package incompatible with PHP 7

Any other items?

consolibyte commented 5 years ago

We are using this in production, for several thousand customers, with Composer, and MySQLi, in PHP 7.x. Works just fine.

If you're having issues, please post the error messages you're referring to.

We will have an update which doesn't reply on mcrypt available soon.

ebogdanov commented 5 years ago

@consolibyte What you do not like in my pull requests?

noydarly commented 5 years ago

It happens with me. Upgraded PHP version to 7.2 and this error came out.

PHP Fatal error: Redefinition of parameter $action in /var/www/spectrum4med.com/data/library/QuickBooks/QuickBooks/Callbacks.php on line 587

@consolibyte Could you please look into this issue and tell me what I am going to do? Thank you.

noydarly commented 5 years ago

Updated to the latest version, and got another error from deprecated functions since PHP 7.1, which you mentioned you would have an update. We are in production mode, is there any other way we could keep using until you get an update?

noydarly commented 5 years ago

public function oauthLoad($key, $app_username, $app_tenant) { if ($data = $this->_oauthLoad($app_username, $app_tenant)) { if (strlen($data['oauth_access_token']) > 0) { //$AES = QuickBooks_Encryption_Factory::create('aes'); $AES = QuickBooks_Encryption_Factory::create('rc4');

            $data['oauth_access_token'] = $AES->decrypt($key, $data['oauth_access_token']);
            $data['oauth_access_token_secret'] = $AES->decrypt($key, $data['oauth_access_token_secret']);
        }

        return $data;
    }

    return false;
}

I changed the driver.php myself, is this ok totally?

amcardwell commented 5 years ago

I'm having the same issue

In Mysql.php line 289: Call to undefined function mysql_connect()

using PHP 7.2.2

compwright commented 5 years ago

Additional PHP 7 issues:

File Type Issue
QuickBooks/Utilities.php:339 function Function "split()" is deprecated.
QuickBooks/Utilities.php:377 function Function "ereg()" is deprecated.
QuickBooks/Utilities.php:409 function Function "ereg()" is deprecated.
QuickBooks/Cast.php:506 function_usage Function usage "preg_replace() (@preg_replace_e_modifier)" is deprecated.
QuickBooks/Cast.php:527 function_usage Function usage "preg_replace() (@preg_replace_e_modifier)" is deprecated.
QuickBooks/Cast.php:533 function_usage Function usage "preg_replace() (@preg_replace_e_modifier)" is deprecated.
QuickBooks/Cast.php:539 function_usage Function usage "preg_replace() (@preg_replace_e_modifier)" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:289 function Function "mysql_connect()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:289 function Function "mysql_error()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:293 function Function "mysql_connect()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:293 function Function "mysql_error()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:297 function Function "mysql_select_db()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:297 function Function "mysql_error()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:300 function Function "mysql_query()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:313 function Function "mysql_fetch_assoc()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:341 function Function "mysql_query()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:371 function Function "mysql_errno()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:372 function Function "mysql_error()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:425 function Function "mysql_affected_rows()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:435 function Function "mysql_insert_id()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:479 function Function "mysql_num_rows()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:481 function Function "mysql_data_seek()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:495 function Function "mysql_real_escape_string()" is deprecated.
QuickBooks/Driver/Sql/Mysql.php:506 function Function "mysql_num_rows()" is deprecated.
docs/example_app_web_connector/config.php:45 function Function "mysql_query()" is deprecated.
docs/example_app_web_connector/functions.php:21 function Function "mysql_fetch_assoc()" is deprecated.
docs/example_app_web_connector/functions.php:21 function Function "mysql_query()" is deprecated.
docs/example_app_web_connector/functions.php:46 function Function "mysql_query()" is deprecated.
docs/example_app_web_connector/functions.php:50 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/functions.php:51 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/functions.php:61 function Function "mysql_query()" is deprecated.
docs/example_app_web_connector/functions.php:65 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/functions.php:66 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/handler.php:24 function Function "mysql_query()" is deprecated.
docs/example_app_web_connector/handler.php:32 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/handler.php:33 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/handler.php:34 function Function "mysql_escape_string()" is deprecated.
docs/example_app_web_connector/handler.php:38 function Function "mysql_insert_id()" is deprecated.
docs/example_web_connector_import.php:182 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:182 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:413 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:417 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:424 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:427 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:427 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:427 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:448 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:452 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:459 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:563 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:567 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:574 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:677 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:681 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:688 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:691 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:691 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:691 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:712 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:716 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:723 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:848 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_import.php:855 function Function "mysql_query()" is deprecated.
docs/example_web_connector_import.php:862 function Function "mysql_error()" is deprecated.
docs/example_web_connector_import.php:959 function Function "mysql_real_escape_string()" is deprecated.
docs/example_web_connector_queueing.php:28 function Function "mysql_connect()" is deprecated.
docs/example_web_connector_queueing.php:31 function Function "mysql_error()" is deprecated.
docs/example_web_connector_queueing.php:35 function Function "mysql_select_db()" is deprecated.
docs/example_web_connector_queueing.php:38 function Function "mysql_error()" is deprecated.
docs/example_web_connector_queueing.php:42 function Function "mysql_query()" is deprecated.
docs/example_web_connector_queueing.php:43 function Function "mysql_insert_id()" is deprecated.
QuickBooks/WebConnector/Server.php:197 variable Variable "$HTTP_RAW_POST_DATA" is deprecated.
QuickBooks/WebConnector/Server.php:197 variable Variable "$HTTP_RAW_POST_DATA" is deprecated.
QuickBooks/WebConnector/Server.php:199 variable Variable "$HTTP_RAW_POST_DATA" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:314 function Function "mssql_min_message_severity()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:315 function Function "mssql_min_error_severity()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:319 function Function "mssql_connect()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:319 function Function "mssql_get_last_message()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:323 function Function "mssql_connect()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:323 function Function "mssql_get_last_message()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:326 function Function "mssql_select_db()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:337 function Function "mssql_fetch_assoc()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:384 function Function "mssql_query()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:389 function Function "mssql_get_last_message()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:420 function Function "mssql_rows_affected()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:449 function Function "mssql_num_rows()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:451 function Function "mssql_data_seek()" is deprecated.
QuickBooks/Driver/Sql/Mssql.php:512 function Function "mssql_num_rows()" is deprecated.
QuickBooks/Encryption/Aes.php:34 function Function "mcrypt_module_open()" is deprecated.
QuickBooks/Encryption/Aes.php:35 function Function "mcrypt_create_iv()" is deprecated.
QuickBooks/Encryption/Aes.php:35 function Function "mcrypt_enc_get_iv_size()" is deprecated.
QuickBooks/Encryption/Aes.php:36 function Function "mcrypt_enc_get_key_size()" is deprecated.
QuickBooks/Encryption/Aes.php:39 function Function "mcrypt_generic_init()" is deprecated.
QuickBooks/Encryption/Aes.php:40 function Function "mcrypt_generic()" is deprecated.
QuickBooks/Encryption/Aes.php:41 function Function "mcrypt_generic_deinit()" is deprecated.
QuickBooks/Encryption/Aes.php:42 function Function "mcrypt_module_close()" is deprecated.
QuickBooks/Encryption/Aes.php:49 function Function "mcrypt_module_open()" is deprecated.
QuickBooks/Encryption/Aes.php:50 function Function "mcrypt_enc_get_iv_size()" is deprecated.
QuickBooks/Encryption/Aes.php:51 function Function "mcrypt_enc_get_key_size()" is deprecated.
QuickBooks/Encryption/Aes.php:63 function Function "mcrypt_generic_init()" is deprecated.
QuickBooks/Encryption/Aes.php:64 function Function "mdecrypt_generic()" is deprecated.
QuickBooks/Encryption/Aes.php:65 function Function "mcrypt_generic_deinit()" is deprecated.
QuickBooks/Encryption/Aes.php:66 function Function "mcrypt_module_close()" is deprecated.
QuickBooks/IPP/Federator.php:606 function Function "mcrypt_get_iv_size()" is deprecated.
QuickBooks/IPP/Federator.php:621 function Function "mcrypt_decrypt()" is deprecated.
QuickBooks/Utilities.php:746 function Function "create_function()" is deprecated.
ajaygiri97 commented 5 years ago

Please download latest code from git repo. If you download website then it will give error like as you saying

compwright commented 5 years ago

@ajaygiri97 thanks, the consolibyte/quickbooks@3.6 does seem to be working in PHP 7.3 so far.

Note - to use MySQLi or some other database driver, just specify the appropriate DSN (e.g., mysqli:// instead of mysql://).

WiredWonder commented 5 years ago

Am I going nuts guys? I am using the SDK from the 3.6 release and have been fine on php7.0.

Recently upgraded to 7.3 (Debian Buster) and I am getting scores of warnings:

Deprecated: Function mcrypt_module_open() is deprecated in /QuickBooks/Encryption/Aes.php on line 59

Deprecated: Function mcrypt_enc_get_iv_size() is deprecated in /QuickBooks/Encryption/Aes.php on line 60

Deprecated: Function mcrypt_enc_get_key_size() is deprecated in /QuickBooks/Encryption/Aes.php on line 61

Deprecated: Function mcrypt_generic_init() is deprecated in /QuickBooks/Encryption/Aes.php on line 73

Deprecated: Function mdecrypt_generic() is deprecated in /QuickBooks/Encryption/Aes.php on line 74

Deprecated: Function mcrypt_generic_deinit() is deprecated in /QuickBooks/Encryption/Aes.php on line 75

Warning: count(): Parameter must be an array or an object that implements Countable in /QuickBooks/HTTP.php on line 248

Warning: count(): Parameter must be an array or an object that implements Countable in /QuickBooks/HTTP.php on line 482

Warning: count(): Parameter must be an array or an object that implements Countable in /QuickBooks/HTTP.php on line 248

Any help appreciated.

compwright commented 5 years ago

I'm not experiencing those warnings, but then again I'm not using the oauth functionality either.

@consolibyte says earlier in this thread that they are working on an update to remove the mcrypt dependency:

We will have an update which doesn't reply on mcrypt available soon.

WiredWonder commented 5 years ago

The HTTP warnings are coming from each API call to QBO. I have checked and my SDK files are up to date with the current release. Any other tips appreciated as disabling error reporting does not seem to work and my logs are filled with garbage.

compwright commented 5 years ago

Yeah, see, I'm using it to communicate with QuickBooks Desktop via the QB Web Connector. It's working fine. We've been wanting to switch to QB Online at some point, so good to know that this SDK is apparently not ready.

My advice would be to fork, fix, and submit a pull request. Or, you could try reaching out to @consolibyte. Or, if you'd like to hire me to help you with this, contact me at https://compwright.com.

WiredWonder commented 5 years ago

The last pull request I followed was ignored.

@consolibyte Keith do you have an ETA on this fix? PHP 7.3 is the default under Debian Buster.

ItsDanielHarris commented 5 years ago

Has this been fixed?

dahoovdog commented 4 years ago

We are trying to update from OAuth 1.0 to OAuth 2.0 by the deadline of Dec 17 but this package is still using mcrypt_module_open and other deprecated PHP functions. Is there a timeline on when this will be fixed?

ebogdanov commented 4 years ago

@dahoovdog You can try to use my version of openssl usage https://github.com/ebogdanov/quickbooks-php/tree/encryption/mcrypt-to-openssl

But in general I suggest you to consider migration for V3 SDK from Intuit. This project is not actively maintained, and code style is outdated. Unless you've strong developers able fixing bugs, it's a headache to support big solutions which are using this library. You can check issues for last 1,5 years - them are not actively maintained.