mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- MFB: New parameter parsing API
This commit is contained in:
parent
4b50d12a48
commit
0703032a7b
1 changed files with 9 additions and 10 deletions
|
@ -188,17 +188,18 @@ error_exit:
|
||||||
PHP_FUNCTION(recode_file)
|
PHP_FUNCTION(recode_file)
|
||||||
{
|
{
|
||||||
RECODE_REQUEST request = NULL;
|
RECODE_REQUEST request = NULL;
|
||||||
zval **req;
|
char *req;
|
||||||
zval **input, **output;
|
int req_len;
|
||||||
|
zval *input, *output;
|
||||||
php_stream *instream, *outstream;
|
php_stream *instream, *outstream;
|
||||||
FILE *in_fp, *out_fp;
|
FILE *in_fp, *out_fp;
|
||||||
|
|
||||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srr", &req, &req_len, &input, &output) == FAILURE) {
|
||||||
WRONG_PARAM_COUNT;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
php_stream_from_zval(instream, input);
|
php_stream_from_zval(instream, &input);
|
||||||
php_stream_from_zval(outstream, output);
|
php_stream_from_zval(outstream, &output);
|
||||||
|
|
||||||
if (FAILURE == php_stream_cast(instream, PHP_STREAM_AS_STDIO, (void**)&in_fp, REPORT_ERRORS)) {
|
if (FAILURE == php_stream_cast(instream, PHP_STREAM_AS_STDIO, (void**)&in_fp, REPORT_ERRORS)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -208,16 +209,14 @@ PHP_FUNCTION(recode_file)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_to_string_ex(req);
|
|
||||||
|
|
||||||
request = recode_new_request(ReSG(outer));
|
request = recode_new_request(ReSG(outer));
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate request structure");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate request structure");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recode_scan_request(request, Z_STRVAL_PP(req))) {
|
if (!recode_scan_request(request, req)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", req);
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue