@@ -310,6 +310,12 @@ ZEND_END_ARG_INFO()
310310
311311ZEND_BEGIN_ARG_INFO (arginfo_ibase_get_client_version , 0 )
312312ZEND_END_ARG_INFO ()
313+
314+ ZEND_BEGIN_ARG_INFO (arginfo_ibase_get_client_major_version , 0 )
315+ ZEND_END_ARG_INFO ()
316+
317+ ZEND_BEGIN_ARG_INFO (arginfo_ibase_get_client_minor_version , 0 )
318+ ZEND_END_ARG_INFO ()
313319/* }}} */
314320
315321/* {{{ extension definition structures */
@@ -369,6 +375,8 @@ static const zend_function_entry ibase_functions[] = {
369375 PHP_FE (ibase_free_event_handler , arginfo_ibase_free_event_handler )
370376
371377 PHP_FE (ibase_get_client_version , arginfo_ibase_get_client_version )
378+ PHP_FE (ibase_get_client_major_version , arginfo_ibase_get_client_major_version )
379+ PHP_FE (ibase_get_client_minor_version , arginfo_ibase_get_client_minor_version )
372380
373381 /**
374382 * These aliases are provided in order to maintain forward compatibility. As Firebird
@@ -432,6 +440,8 @@ static const zend_function_entry ibase_functions[] = {
432440 PHP_FALIAS (fbird_free_event_handler , ibase_free_event_handler , arginfo_ibase_free_event_handler )
433441
434442 PHP_FALIAS (fbird_get_client_version , ibase_get_client_version , arginfo_ibase_get_client_version )
443+ PHP_FALIAS (fbird_get_client_major_version , ibase_get_client_major_version , arginfo_ibase_get_client_major_version )
444+ PHP_FALIAS (fbird_get_client_minor_version , ibase_get_client_minor_version , arginfo_ibase_get_client_minor_version )
435445 PHP_FE_END
436446};
437447
@@ -486,14 +496,26 @@ PHP_FUNCTION(ibase_errmsg)
486496 Return client version in form major.minor */
487497PHP_FUNCTION (ibase_get_client_version )
488498{
489- if (zend_parse_parameters_none () == FAILURE ) {
490- return ;
491- }
492-
493499 RETURN_DOUBLE ((double )IBG (client_major_version ) + (double )IBG (client_minor_version ) / 10 );
494500}
495501/* }}} */
496502
503+ /* {{{ proto int ibase_get_client_major_version(void)
504+ Return client major version */
505+ PHP_FUNCTION (ibase_get_client_major_version )
506+ {
507+ RETURN_LONG (IBG (client_major_version ));
508+ }
509+ /* }}} */
510+
511+ /* {{{ proto int ibase_get_client_minor_version(void)
512+ Return client minor version */
513+ PHP_FUNCTION (ibase_get_client_minor_version )
514+ {
515+ RETURN_LONG (IBG (client_minor_version ));
516+ }
517+ /* }}} */
518+
497519/* {{{ proto int ibase_errcode(void)
498520 Return error code */
499521PHP_FUNCTION (ibase_errcode )
@@ -820,7 +842,7 @@ static PHP_GINIT_FUNCTION(ibase)
820842 if (ibase_globals -> get_master_interface ) {
821843 ibase_globals -> master_instance = ((fb_get_master_interface_t )(ibase_globals -> get_master_interface ))();
822844 ibase_globals -> client_version = fb_get_client_version (ibase_globals -> master_instance );
823- ibase_globals -> client_major_version = ibase_globals -> client_version >> 8 ;
845+ ibase_globals -> client_major_version = ( ibase_globals -> client_version >> 8 ) & 0xFF ;
824846 ibase_globals -> client_minor_version = ibase_globals -> client_version & 0xFF ;
825847 } else {
826848 ibase_globals -> master_instance = NULL ;
0 commit comments