@@ -59,31 +59,30 @@ static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC)
5959 Perform an apache sub-request */
6060PHP_FUNCTION (virtual )
6161{
62- zval * * filename ;
62+ char * filename ;
63+ int filename_len ;
6364request_rec * rr ;
6465
65- if (ZEND_NUM_ARGS () != 1 || zend_get_parameters_ex ( 1 , & filename ) == FAILURE ) {
66- WRONG_PARAM_COUNT ;
66+ if (zend_parse_parameters ( ZEND_NUM_ARGS () TSRMLS_CC , "s" , & filename , & filename_len ) == FAILURE ) {
67+ return ;
6768}
6869
69- convert_to_string_ex (filename );
70-
71- if (!(rr = php_apache_lookup_uri (Z_STRVAL_PP (filename ) TSRMLS_CC ))) {
72- php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - URI lookup failed" , Z_STRVAL_PP (filename ));
70+ if (!(rr = php_apache_lookup_uri (filename TSRMLS_CC ))) {
71+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - URI lookup failed" , filename );
7372RETURN_FALSE ;
7473}
7574
7675if (rr -> status == HTTP_OK ) {
7776if (ap_run_sub_req (rr )) {
78- php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - request execution failed" , Z_STRVAL_PP ( filename ) );
77+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - request execution failed" , filename );
7978ap_destroy_sub_req (rr );
8079RETURN_FALSE ;
8180}
8281ap_destroy_sub_req (rr );
8382RETURN_TRUE ;
8483}
8584
86- php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - error finding URI" , Z_STRVAL_PP ( filename ) );
85+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - error finding URI" , filename );
8786ap_destroy_sub_req (rr );
8887RETURN_FALSE ;
8988}
@@ -99,16 +98,15 @@ PHP_FUNCTION(virtual)
9998PHP_FUNCTION (apache_lookup_uri )
10099{
101100request_rec * rr ;
102- zval * * filename ;
101+ char * filename ;
102+ int filename_len ;
103103
104- if (ZEND_NUM_ARGS () != 1 || zend_get_parameters_ex ( 1 , & filename ) == FAILURE ) {
105- WRONG_PARAM_COUNT ;
104+ if (zend_parse_parameters ( ZEND_NUM_ARGS () TSRMLS_CC , "s" , & filename , & filename_len ) == FAILURE ) {
105+ return ;
106106}
107107
108- convert_to_string_ex (filename );
109-
110- if (!(rr = php_apache_lookup_uri (Z_STRVAL_PP (filename ) TSRMLS_CC ))) {
111- php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - URI lookup failed" , Z_STRVAL_PP (filename ));
108+ if (!(rr = php_apache_lookup_uri (filename TSRMLS_CC ))) {
109+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - URI lookup failed" , filename );
112110RETURN_FALSE ;
113111}
114112
@@ -145,7 +143,7 @@ PHP_FUNCTION(apache_lookup_uri)
145143return ;
146144}
147145
148- php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - error finding URI" , Z_STRVAL_PP ( filename ) );
146+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to include '%s' - error finding URI" , filename );
149147ap_destroy_sub_req (rr );
150148RETURN_FALSE ;
151149}
@@ -195,31 +193,28 @@ PHP_FUNCTION(apache_response_headers)
195193PHP_FUNCTION (apache_note )
196194{
197195php_struct * ctx ;
198- zval * * note_name , * * note_val ;
196+ char * note_name , * note_val ;
197+ int note_name_len , note_val_len ;
199198char * old_note_val = NULL ;
200199int arg_count = ZEND_NUM_ARGS ();
201200
202- if (arg_count < 1 || arg_count > 2 ||
203- zend_get_parameters_ex (arg_count , & note_name , & note_val ) == FAILURE ) {
204- WRONG_PARAM_COUNT ;
201+ if (zend_parse_parameters (arg_count TSRMLS_CC , "s|s" , & note_name , & note_name_len , & note_val , & note_val_len ) == FAILURE ) {
202+ return ;
205203}
206-
204+
207205ctx = SG (server_context );
208-
209- convert_to_string_ex (note_name );
210206
211- old_note_val = (char * ) apr_table_get (ctx -> r -> notes , Z_STRVAL_PP ( note_name ) );
212-
207+ old_note_val = (char * ) apr_table_get (ctx -> r -> notes , note_name );
208+
213209if (arg_count == 2 ) {
214- convert_to_string_ex (note_val );
215- apr_table_set (ctx -> r -> notes , Z_STRVAL_PP (note_name ), Z_STRVAL_PP (note_val ));
210+ apr_table_set (ctx -> r -> notes , note_name , note_val );
216211}
217212
218213if (old_note_val ) {
219214RETURN_STRING (old_note_val , 1 );
220- } else {
221- RETURN_FALSE ;
222215}
216+
217+ RETURN_FALSE ;
223218}
224219/* }}} */
225220
@@ -229,26 +224,24 @@ PHP_FUNCTION(apache_note)
229224PHP_FUNCTION (apache_setenv )
230225{
231226php_struct * ctx ;
232- zval * * variable = NULL , * * string_val = NULL , * * walk_to_top = NULL ;
227+ char * variable = NULL , * string_val = NULL ;
228+ int variable_len , string_val_len ;
229+ zend_bool walk_to_top = 0 ;
233230int arg_count = ZEND_NUM_ARGS ();
234231
235- if (arg_count < 1 || arg_count > 3 ||
236- zend_get_parameters_ex (arg_count , & variable , & string_val , & walk_to_top ) == FAILURE ) {
237- WRONG_PARAM_COUNT ;
232+ if (zend_parse_parameters (arg_count TSRMLS_CC , "ss|b" , & variable , & variable_len , & string_val , & string_val_len , & walk_to_top ) == FAILURE ) {
233+ return ;
238234}
239235
240236ctx = SG (server_context );
241237
242- if (arg_count == 3 && Z_STRVAL_PP ( walk_to_top ) ) {
238+ if (arg_count == 3 && walk_to_top ) {
243239while (ctx -> f -> r -> prev ) {
244240ctx -> f -> r = ctx -> f -> r -> prev ;
245- }
241+ }
246242}
247243
248- convert_to_string_ex (variable );
249- convert_to_string_ex (string_val );
250-
251- apr_table_set (ctx -> r -> subprocess_env , Z_STRVAL_PP (variable ), Z_STRVAL_PP (string_val ));
244+ apr_table_set (ctx -> r -> subprocess_env , variable , string_val );
252245
253246RETURN_TRUE ;
254247}
@@ -259,31 +252,30 @@ PHP_FUNCTION(apache_setenv)
259252PHP_FUNCTION (apache_getenv )
260253{
261254php_struct * ctx ;
262- zval * * variable = NULL , * * walk_to_top = NULL ;
255+ char * variable = NULL ;
256+ int variable_len ;
257+ zend_bool walk_to_top = 0 ;
263258int arg_count = ZEND_NUM_ARGS ();
264259char * env_val = NULL ;
265260
266- if (arg_count < 1 || arg_count > 2 ||
267- zend_get_parameters_ex (arg_count , & variable , & walk_to_top ) == FAILURE ) {
268- WRONG_PARAM_COUNT ;
261+ if (zend_parse_parameters (arg_count TSRMLS_CC , "s|b" , & variable , & variable_len , & walk_to_top ) == FAILURE ) {
262+ return ;
269263}
270264
271265ctx = SG (server_context );
272266
273- if (arg_count == 2 && Z_STRVAL_PP ( walk_to_top ) ) {
267+ if (arg_count == 2 && walk_to_top ) {
274268while (ctx -> f -> r -> prev ) {
275269ctx -> f -> r = ctx -> f -> r -> prev ;
276- }
270+ }
277271}
278272
279- convert_to_string_ex (variable );
280-
281- env_val = (char * ) apr_table_get (ctx -> r -> subprocess_env , Z_STRVAL_PP (variable ));
273+ env_val = (char * ) apr_table_get (ctx -> r -> subprocess_env , variable );
282274if (env_val != NULL ) {
283275RETURN_STRING (env_val , 1 );
284- } else {
285- RETURN_FALSE ;
286- }
276+ }
277+
278+ RETURN_FALSE ;
287279}
288280/* }}} */
289281
0 commit comments