50
50
static int le_ftpbuf ;
51
51
#define le_ftpbuf_name "FTP Buffer"
52
52
53
+ static
54
+ ZEND_BEGIN_ARG_INFO (third_and_rest_force_ref , 1 )
55
+ ZEND_ARG_PASS_INFO (0 )
56
+ ZEND_ARG_PASS_INFO (0 )
57
+ ZEND_ARG_PASS_INFO (1 )
58
+ ZEND_END_ARG_INFO ()
59
+
53
60
function_entry php_ftp_functions [] = {
54
61
PHP_FE (ftp_connect , NULL )
55
62
#ifdef HAVE_OPENSSL_EXT
@@ -64,6 +71,7 @@ function_entry php_ftp_functions[] = {
64
71
PHP_FE (ftp_mkdir , NULL )
65
72
PHP_FE (ftp_rmdir , NULL )
66
73
PHP_FE (ftp_chmod , NULL )
74
+ PHP_FE (ftp_alloc , third_and_rest_force_ref )
67
75
PHP_FE (ftp_nlist , NULL )
68
76
PHP_FE (ftp_rawlist , NULL )
69
77
PHP_FE (ftp_systype , NULL )
@@ -430,6 +438,35 @@ PHP_FUNCTION(ftp_chmod)
430
438
}
431
439
/* }}} */
432
440
441
+ /* {{{ proto bool ftp_alloc(resource stream, int size[, &response])
442
+ Attempt to allocate space on the remote FTP server */
443
+ PHP_FUNCTION (ftp_alloc )
444
+ {
445
+ zval * z_ftp , * zresponse = NULL ;
446
+ ftpbuf_t * ftp ;
447
+ int size , ret ;
448
+ char * response = NULL ;
449
+
450
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "rl|z" , & z_ftp , & size , & zresponse ) == FAILURE ) {
451
+ RETURN_FALSE ;
452
+ }
453
+
454
+ ZEND_FETCH_RESOURCE (ftp , ftpbuf_t * , & z_ftp , -1 , le_ftpbuf_name , le_ftpbuf );
455
+
456
+ ret = ftp_alloc (ftp , size , zresponse ? & response : NULL );
457
+ if (response ) {
458
+ zval_dtor (zresponse );
459
+ ZVAL_STRING (zresponse , response , 0 );
460
+ }
461
+
462
+ if (!ret ) {
463
+ RETURN_FALSE ;
464
+ }
465
+
466
+ RETURN_TRUE ;
467
+ }
468
+ /* }}} */
469
+
433
470
/* {{{ proto array ftp_nlist(resource stream, string directory)
434
471
Returns an array of filenames in the given directory */
435
472
PHP_FUNCTION (ftp_nlist )
0 commit comments