2727
2828/* $Id$ */
2929
30- #ifdef __cplusplus
31- extern "C" {
30+ #include <zend_types.h>
31+ #ifndef _GNU_SOURCE
32+ # define _GNU_SOURCE
3233#endif
33-
34- #define _GNU_SOURCE
3534#include <string.h>
3635
3736#include <php.h>
@@ -270,8 +269,8 @@ static void _rar_dos_date_to_text(unsigned dos_time, char *date_string) /* {{{ *
270269/* }}} */
271270
272271/* {{{ Methods */
273- /* {{{ proto bool RarEntry:: extract(string dir [, string filepath = ''
274- [, string password = NULL [ , bool extended_data = FALSE]])
272+ /* {{{ public function extract(? string $ dir, ? string $ filepath = '',
273+ ? string $ password = null , bool $ extended_data = false): void {}
275274 Extract file from the archive */
276275PHP_METHOD (rarentry , extract )
277276{ /* lots of variables, but no need to be intimidated */
@@ -298,7 +297,7 @@ PHP_METHOD(rarentry, extract)
298297 * password that's different from the one stored in the rar_file_t object*/
299298 rar_cb_user_data cb_udata = {NULL };
300299
301- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s|ss !b" , & dir ,
300+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s!|s!s !b" , & dir ,
302301 & dir_len , & filepath , & filepath_len , & password , & password_len ,
303302 & process_ed ) == FAILURE ) {
304303 return ;
@@ -714,12 +713,21 @@ PHP_METHOD(rarentry, __toString)
714713/* }}} */
715714
716715/* {{{ arginfo */
716+ #if PHP_MAJOR_VERSION < 8
717717ZEND_BEGIN_ARG_INFO_EX (arginfo_rarentry_extract , 0 , 0 , 1 )
718718 ZEND_ARG_INFO (0 , path )
719719 ZEND_ARG_INFO (0 , filename )
720720 ZEND_ARG_INFO (0 , password )
721721 ZEND_ARG_INFO (0 , extended_data )
722722ZEND_END_ARG_INFO ()
723+ #else
724+ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX (arginfo_rarentry_extract , 0 , 1 , _IS_BOOL , 0 )
725+ ZEND_ARG_TYPE_INFO (0 , dir , IS_STRING , 1 )
726+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE (0 , filepath , IS_STRING , 1 , "\'\'" )
727+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE (0 , password , IS_STRING , 1 , "null" )
728+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE (0 , extended_data , _IS_BOOL , 0 , "false" )
729+ ZEND_END_ARG_INFO ()
730+ #endif
723731
724732ZEND_BEGIN_ARG_INFO_EX (arginfo_rarentry_getstream , 0 , 0 , 0 )
725733 ZEND_ARG_INFO (0 , password )
@@ -829,7 +837,3 @@ void minit_rarentry(TSRMLS_D)
829837 REG_RAR_CLASS_CONST_LONG ("ATTRIBUTE_UNIX_SYM_LINK" , 0x0A000L );
830838 REG_RAR_CLASS_CONST_LONG ("ATTRIBUTE_UNIX_SOCKET" , 0x0C000L );
831839}
832-
833- #ifdef __cplusplus
834- }
835- #endif
0 commit comments