PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - lcov_data/ext/standard - url_scanner_ex.re (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 190 233 81.5 %
Date: 2015-07-31 Functions: 20 21 95.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2015 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Author: Sascha Schumann <sascha@schumann.cx>                         |
      16             :   +----------------------------------------------------------------------+
      17             : */
      18             : 
      19             : /* $Id$ */
      20             : 
      21             : #include "php.h"
      22             : 
      23             : #ifdef HAVE_UNISTD_H
      24             : #include <unistd.h>
      25             : #endif
      26             : #ifdef HAVE_LIMITS_H
      27             : #include <limits.h>
      28             : #endif
      29             : 
      30             : #include <stdio.h>
      31             : #include <stdlib.h>
      32             : #include <string.h>
      33             : 
      34             : #include "php_ini.h"
      35             : #include "php_globals.h"
      36             : #define STATE_TAG SOME_OTHER_STATE_TAG
      37             : #include "basic_functions.h"
      38             : #include "url.h"
      39             : #undef STATE_TAG
      40             : 
      41             : #define url_scanner url_scanner_ex
      42             : 
      43             : #include "zend_smart_str.h"
      44             : 
      45      105448 : static void tag_dtor(zval *zv)
      46             : {
      47      105448 :         free(Z_PTR_P(zv));
      48      105448 : }
      49             : 
      50       21053 : static PHP_INI_MH(OnUpdateTags)
      51             : {
      52             :         url_adapt_state_ex_t *ctx;
      53             :         char *key;
      54             :         char *tmp;
      55       21053 :         char *lasts = NULL;
      56             : 
      57       21053 :         ctx = &BG(url_adapt_state_ex);
      58             : 
      59       21053 :         tmp = estrndup(new_value->val, new_value->len);
      60             : 
      61       21053 :         if (ctx->tags)
      62           4 :                 zend_hash_destroy(ctx->tags);
      63             :         else {
      64       21049 :                 ctx->tags = malloc(sizeof(HashTable));
      65       21049 :                 if (!ctx->tags) {
      66           0 :                         return FAILURE;
      67             :                 }
      68             :         }
      69             : 
      70       21053 :         zend_hash_init(ctx->tags, 0, NULL, tag_dtor, 1);
      71             : 
      72      147374 :         for (key = php_strtok_r(tmp, ",", &lasts);
      73             :                         key;
      74      105268 :                         key = php_strtok_r(NULL, ",", &lasts)) {
      75             :                 char *val;
      76             : 
      77      105268 :                 val = strchr(key, '=');
      78      105268 :                 if (val) {
      79             :                         char *q;
      80             :                         size_t keylen;
      81             : 
      82      105268 :                         *val++ = '\0';
      83      568444 :                         for (q = key; *q; q++)
      84      463176 :                                 *q = tolower(*q);
      85      105268 :                         keylen = q - key;
      86             :                         /* key is stored withOUT NUL
      87             :                            val is stored WITH    NUL */
      88      105268 :                         zend_hash_str_add_mem(ctx->tags, key, keylen, val, strlen(val)+1);
      89             :                 }
      90             :         }
      91             : 
      92       21053 :         efree(tmp);
      93             : 
      94       21053 :         return SUCCESS;
      95             : }
      96             : 
      97             : PHP_INI_BEGIN()
      98             :         STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
      99             : PHP_INI_END()
     100             : 
     101             : /*!re2c
     102             : any = [\000-\377];
     103             : N = (any\[<]);
     104             : alpha = [a-zA-Z];
     105             : alphanamespace = [a-zA-Z:];
     106             : alphadash = ([a-zA-Z] | "-");
     107             : */
     108             : 
     109             : #define YYFILL(n) goto done
     110             : #define YYCTYPE unsigned char
     111             : #define YYCURSOR p
     112             : #define YYLIMIT q
     113             : #define YYMARKER r
     114             : 
     115          73 : static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *url_app, const char *separator)
     116             : {
     117             :         register const char *p, *q;
     118          73 :         const char *bash = NULL;
     119          73 :         const char *sep = "?";
     120             : 
     121          73 :         q = (p = url->s->val) + url->s->len;
     122             : 
     123             : scan:
     124             : /*!re2c
     125          31 :   ":"         { smart_str_append_smart_str(dest, url); return; }
     126          26 :   "?"         { sep = separator; goto scan; }
     127          10 :   "#"         { bash = p - 1; goto done; }
     128          65 :   (any\[:?#])+          { goto scan; }
     129             : */
     130             : done:
     131             : 
     132             :         /* Don't modify URLs of the format "#mark" */
     133          42 :         if (bash && bash - url->s->val == 0) {
     134             :                 smart_str_append_smart_str(dest, url);
     135           0 :                 return;
     136             :         }
     137             : 
     138          42 :         if (bash)
     139          10 :                 smart_str_appendl(dest, url->s->val, bash - url->s->val);
     140             :         else
     141             :                 smart_str_append_smart_str(dest, url);
     142             : 
     143          42 :         smart_str_appends(dest, sep);
     144             :         smart_str_append_smart_str(dest, url_app);
     145             : 
     146          42 :         if (bash)
     147          10 :                 smart_str_appendl(dest, bash, q - bash);
     148             : }
     149             : 
     150             : 
     151             : #undef YYFILL
     152             : #undef YYCTYPE
     153             : #undef YYCURSOR
     154             : #undef YYLIMIT
     155             : #undef YYMARKER
     156             : 
     157          79 : static inline void tag_arg(url_adapt_state_ex_t *ctx, char quotes, char type)
     158             : {
     159          79 :         char f = 0;
     160             : 
     161          79 :         if (strncasecmp(ctx->arg.s->val, ctx->lookup_data, ctx->arg.s->len) == 0)
     162          73 :                 f = 1;
     163             : 
     164          79 :         if (quotes)
     165          75 :                 smart_str_appendc(&ctx->result, type);
     166          79 :         if (f) {
     167          73 :                 append_modified_url(&ctx->val, &ctx->result, &ctx->url_app, PG(arg_separator).output);
     168             :         } else {
     169           6 :                 smart_str_append_smart_str(&ctx->result, &ctx->val);
     170             :         }
     171          79 :         if (quotes)
     172          75 :                 smart_str_appendc(&ctx->result, type);
     173          79 : }
     174             : 
     175             : enum {
     176             :         STATE_PLAIN = 0,
     177             :         STATE_TAG,
     178             :         STATE_NEXT_ARG,
     179             :         STATE_ARG,
     180             :         STATE_BEFORE_VAL,
     181             :         STATE_VAL
     182             : };
     183             : 
     184             : #define YYFILL(n) goto stop
     185             : #define YYCTYPE unsigned char
     186             : #define YYCURSOR xp
     187             : #define YYLIMIT end
     188             : #define YYMARKER q
     189             : #define STATE ctx->state
     190             : 
     191             : #define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR
     192             : #define STD_ARGS ctx, start, xp
     193             : 
     194             : #if SCANNER_DEBUG
     195             : #define scdebug(x) printf x
     196             : #else
     197             : #define scdebug(x)
     198             : #endif
     199             : 
     200         789 : static inline void passthru(STD_PARA)
     201             : {
     202             :         scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start));
     203         789 :         smart_str_appendl(&ctx->result, start, YYCURSOR - start);
     204         789 : }
     205             : 
     206             : /*
     207             :  * This function appends a hidden input field after a <form> or
     208             :  * <fieldset>.  The latter is important for XHTML.
     209             :  */
     210             : 
     211          80 : static void handle_form(STD_PARA)
     212             : {
     213          80 :         int doit = 0;
     214             : 
     215          80 :         if (ctx->form_app.s->len > 0) {
     216          80 :                 switch (ctx->tag.s->len) {
     217             :                         case sizeof("form") - 1:
     218           5 :                                 if (!strncasecmp(ctx->tag.s->val, "form", sizeof("form") - 1)) {
     219           5 :                                         doit = 1;
     220             :                                 }
     221           5 :                                 if (doit && ctx->val.s && ctx->lookup_data && *ctx->lookup_data) {
     222           0 :                                         char *e, *p = (char *)zend_memnstr(ctx->val.s->val, "://", sizeof("://") - 1, ctx->val.s->val + ctx->val.s->len);
     223           0 :                                         if (p) {
     224           0 :                                                 e = memchr(p, '/', (ctx->val.s->val + ctx->val.s->len) - p);
     225           0 :                                                 if (!e) {
     226           0 :                                                         e = ctx->val.s->val + ctx->val.s->len;
     227             :                                                 }
     228           0 :                                                 if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
     229           0 :                                                         doit = 0;
     230             :                                                 }
     231             :                                         }
     232             :                                 }
     233           5 :                                 break;
     234             : 
     235             :                         case sizeof("fieldset") - 1:
     236           2 :                                 if (!strncasecmp(ctx->tag.s->val, "fieldset", sizeof("fieldset") - 1)) {
     237           2 :                                         doit = 1;
     238             :                                 }
     239             :                                 break;
     240             :                 }
     241             : 
     242          80 :                 if (doit)
     243           7 :                         smart_str_append_smart_str(&ctx->result, &ctx->form_app);
     244             :         }
     245          80 : }
     246             : 
     247             : /*
     248             :  *  HANDLE_TAG copies the HTML Tag and checks whether we
     249             :  *  have that tag in our table. If we might modify it,
     250             :  *  we continue to scan the tag, otherwise we simply copy the complete
     251             :  *  HTML stuff to the result buffer.
     252             :  */
     253             : 
     254          92 : static inline void handle_tag(STD_PARA)
     255             : {
     256          92 :         int ok = 0;
     257             :         unsigned int i;
     258             : 
     259          92 :         if (ctx->tag.s) {
     260          81 :                 ctx->tag.s->len = 0;
     261             :         }
     262          92 :         smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
     263         253 :         for (i = 0; i < ctx->tag.s->len; i++)
     264         161 :                 ctx->tag.s->val[i] = tolower((int)(unsigned char)ctx->tag.s->val[i]);
     265             :     /* intentionally using str_find here, in case the hash value is set, but the string val is changed later */
     266         184 :         if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ctx->tag.s->val, ctx->tag.s->len)) != NULL)
     267          80 :                 ok = 1;
     268          92 :         STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
     269          92 : }
     270             : 
     271          79 : static inline void handle_arg(STD_PARA)
     272             : {
     273          79 :         if (ctx->arg.s) {
     274          69 :                 ctx->arg.s->len = 0;
     275             :         }
     276          79 :         smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
     277          79 : }
     278             : 
     279          79 : static inline void handle_val(STD_PARA, char quotes, char type)
     280             : {
     281          79 :         smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
     282          79 :         tag_arg(ctx, quotes, type);
     283          79 : }
     284             : 
     285          15 : static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
     286             : {
     287             :         char *end, *q;
     288             :         char *xp;
     289             :         char *start;
     290             :         size_t rest;
     291             : 
     292          15 :         smart_str_appendl(&ctx->buf, newdata, newlen);
     293             : 
     294          15 :         YYCURSOR = ctx->buf.s->val;
     295          15 :         YYLIMIT = ctx->buf.s->val + ctx->buf.s->len;
     296             : 
     297          15 :         switch (STATE) {
     298          15 :                 case STATE_PLAIN: goto state_plain;
     299           0 :                 case STATE_TAG: goto state_tag;
     300           0 :                 case STATE_NEXT_ARG: goto state_next_arg;
     301           0 :                 case STATE_ARG: goto state_arg;
     302           0 :                 case STATE_BEFORE_VAL: goto state_before_val;
     303           0 :                 case STATE_VAL: goto state_val;
     304             :         }
     305             : 
     306             : 
     307             : state_plain_begin:
     308         149 :         STATE = STATE_PLAIN;
     309             : 
     310             : state_plain:
     311         324 :         start = YYCURSOR;
     312             : /*!re2c
     313         161 :   "<"                              { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
     314         148 :   N+                            { passthru(STD_ARGS); goto state_plain; }
     315             : */
     316             : 
     317             : state_tag:
     318         161 :         start = YYCURSOR;
     319             : /*!re2c
     320          92 :   alphanamespace+       { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
     321          69 :   any           { passthru(STD_ARGS); goto state_plain_begin; }
     322             : */
     323             : 
     324             : state_next_arg_begin:
     325          79 :         STATE = STATE_NEXT_ARG;
     326             : 
     327             : state_next_arg:
     328         240 :         start = YYCURSOR;
     329             : /*!re2c
     330          80 :   [/]? [>]           { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
     331          81 :   [ \v\r\t\n]+  { passthru(STD_ARGS); goto state_next_arg; }
     332          79 :   alpha         { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
     333           0 :   any           { passthru(STD_ARGS); goto state_plain_begin; }
     334             : */
     335             : 
     336             : state_arg:
     337          79 :         start = YYCURSOR;
     338             : /*!re2c
     339          79 :   alpha alphadash*      { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
     340           0 :   any           { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
     341             : */
     342             : 
     343             : state_before_val:
     344          79 :         start = YYCURSOR;
     345             : /*!re2c
     346          79 :   [ ]* "=" [ ]*               { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
     347           0 :   any                           { --YYCURSOR; goto state_next_arg_begin; }
     348             : */
     349             : 
     350             : 
     351             : state_val:
     352          79 :         start = YYCURSOR;
     353             : /*!re2c
     354          73 :   ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
     355           2 :   ['] (any\['>])* [']        { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
     356           4 :   (any\[ \r\t\n>'"])+   { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
     357           0 :   any                                   { passthru(STD_ARGS); goto state_next_arg_begin; }
     358             : */
     359             : 
     360             : stop:
     361          15 :         if (YYLIMIT < start) {
     362             :                 /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
     363           0 :                 rest = 0;
     364             :         } else {
     365          15 :                 rest = YYLIMIT - start;
     366             :                 scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
     367             :         }
     368             : 
     369          15 :         if (rest) memmove(ctx->buf.s->val, start, rest);
     370          15 :         ctx->buf.s->len = rest;
     371          15 : }
     372             : 
     373             : 
     374           0 : PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode)
     375             : {
     376             :         char *result;
     377           0 :         smart_str surl = {0};
     378           0 :         smart_str buf = {0};
     379           0 :         smart_str url_app = {0};
     380             :         zend_string *encoded;
     381             : 
     382             :         smart_str_appendl(&surl, url, urllen);
     383             : 
     384           0 :         if (urlencode) {
     385           0 :                 encoded = php_raw_url_encode(name, strlen(name));
     386           0 :                 smart_str_appendl(&url_app, encoded->val, encoded->len);
     387             :                 zend_string_free(encoded);
     388             :         } else {
     389           0 :                 smart_str_appends(&url_app, name);
     390             :         }
     391             :         smart_str_appendc(&url_app, '=');
     392           0 :         if (urlencode) {
     393           0 :                 encoded = php_raw_url_encode(value, strlen(value));
     394           0 :                 smart_str_appendl(&url_app, encoded->val, encoded->len);
     395             :                 zend_string_free(encoded);
     396             :         } else {
     397           0 :                 smart_str_appends(&url_app, value);
     398             :         }
     399             : 
     400           0 :         append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
     401             : 
     402             :         smart_str_0(&buf);
     403           0 :         if (newlen) *newlen = buf.s->len;
     404           0 :         result = estrndup(buf.s->val, buf.s->len);
     405             : 
     406             :         smart_str_free(&url_app);
     407             :         smart_str_free(&buf);
     408             : 
     409           0 :         return result;
     410             : }
     411             : 
     412             : 
     413          15 : static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush)
     414             : {
     415             :         url_adapt_state_ex_t *ctx;
     416             :         char *retval;
     417             : 
     418          15 :         ctx = &BG(url_adapt_state_ex);
     419             : 
     420          15 :         xx_mainloop(ctx, src, srclen);
     421             : 
     422          15 :         if (!ctx->result.s) {
     423           1 :                 smart_str_appendl(&ctx->result, "", 0);
     424           1 :                 *newlen = 0;
     425             :         } else {
     426          14 :                 *newlen = ctx->result.s->len;
     427             :         }
     428          15 :         smart_str_0(&ctx->result);
     429          15 :         if (do_flush) {
     430          15 :                 smart_str_append(&ctx->result, ctx->buf.s);
     431          15 :                 *newlen += ctx->buf.s->len;
     432          15 :                 smart_str_free(&ctx->buf);
     433          15 :                 smart_str_free(&ctx->val);
     434             :         }
     435          15 :         retval = estrndup(ctx->result.s->val, ctx->result.s->len);
     436          15 :         smart_str_free(&ctx->result);
     437          15 :         return retval;
     438             : }
     439             : 
     440          11 : static int php_url_scanner_ex_activate(void)
     441             : {
     442             :         url_adapt_state_ex_t *ctx;
     443             : 
     444          11 :         ctx = &BG(url_adapt_state_ex);
     445             : 
     446          11 :         memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
     447             : 
     448          11 :         return SUCCESS;
     449             : }
     450             : 
     451          11 : static int php_url_scanner_ex_deactivate(void)
     452             : {
     453             :         url_adapt_state_ex_t *ctx;
     454             : 
     455          11 :         ctx = &BG(url_adapt_state_ex);
     456             : 
     457          11 :         smart_str_free(&ctx->result);
     458          11 :         smart_str_free(&ctx->buf);
     459          11 :         smart_str_free(&ctx->tag);
     460          11 :         smart_str_free(&ctx->arg);
     461             : 
     462          11 :         return SUCCESS;
     463             : }
     464             : 
     465          16 : static void php_url_scanner_output_handler(char *output, size_t output_len, char **handled_output, size_t *handled_output_len, int mode)
     466             : {
     467             :         size_t len;
     468             : 
     469          16 :         if (BG(url_adapt_state_ex).url_app.s->len != 0) {
     470          15 :                 *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0));
     471             :                 if (sizeof(uint) < sizeof(size_t)) {
     472          15 :                         if (len > UINT_MAX)
     473           0 :                                 len = UINT_MAX;
     474             :                 }
     475          15 :                 *handled_output_len = len;
     476           1 :         } else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
     477           1 :                 url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
     478           1 :                 if (ctx->buf.s && ctx->buf.s->len) {
     479           0 :                         smart_str_append(&ctx->result, ctx->buf.s);
     480           0 :                         smart_str_appendl(&ctx->result, output, output_len);
     481             : 
     482           0 :                         *handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
     483           0 :                         *handled_output_len = ctx->buf.s->len + output_len;
     484             : 
     485           0 :                         smart_str_free(&ctx->buf);
     486           0 :                         smart_str_free(&ctx->result);
     487             :                 } else {
     488           1 :                         *handled_output = estrndup(output, *handled_output_len = output_len);
     489             :                 }
     490             :         } else {
     491           0 :                 *handled_output = NULL;
     492             :         }
     493          16 : }
     494             : 
     495          13 : PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode)
     496             : {
     497          13 :         smart_str sname = {0};
     498          13 :         smart_str svalue = {0};
     499             :         zend_string *encoded;
     500             : 
     501          13 :         if (!BG(url_adapt_state_ex).active) {
     502          11 :                 php_url_scanner_ex_activate();
     503          11 :                 php_output_start_internal(ZEND_STRL("URL-Rewriter"), php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
     504          11 :                 BG(url_adapt_state_ex).active = 1;
     505             :         }
     506             : 
     507          13 :         if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) {
     508           2 :                 smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
     509             :         }
     510             : 
     511          13 :         if (urlencode) {
     512          13 :                 encoded = php_raw_url_encode(name, name_len);
     513          13 :                 smart_str_appendl(&sname, encoded->val, encoded->len);
     514             :                 zend_string_free(encoded);
     515          13 :                 encoded = php_raw_url_encode(value, value_len);
     516          13 :                 smart_str_appendl(&svalue, encoded->val, encoded->len);
     517             :                 zend_string_free(encoded);
     518             :         } else {
     519             :                 smart_str_appendl(&sname, name, name_len);
     520             :                 smart_str_appendl(&svalue, value, value_len);
     521             :         }
     522             : 
     523             :         smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &sname);
     524             :         smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
     525             :         smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &svalue);
     526             : 
     527             :         smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
     528             :         smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &sname);
     529             :         smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
     530             :         smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &svalue);
     531             :         smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
     532             : 
     533             :         smart_str_free(&sname);
     534             :         smart_str_free(&svalue);
     535             : 
     536          13 :         return SUCCESS;
     537             : }
     538             : 
     539           1 : PHPAPI int php_url_scanner_reset_vars(void)
     540             : {
     541           1 :         if (BG(url_adapt_state_ex).form_app.s) {
     542           1 :                 BG(url_adapt_state_ex).form_app.s->len = 0;
     543             :         }
     544           1 :         if (BG(url_adapt_state_ex).url_app.s) {
     545           1 :                 BG(url_adapt_state_ex).url_app.s->len = 0;
     546             :         }
     547             : 
     548           1 :         return SUCCESS;
     549             : }
     550             : 
     551       21049 : PHP_MINIT_FUNCTION(url_scanner)
     552             : {
     553       21049 :         BG(url_adapt_state_ex).tags = NULL;
     554             : 
     555       21049 :         BG(url_adapt_state_ex).form_app.s = BG(url_adapt_state_ex).url_app.s = NULL;
     556             : 
     557       21049 :         REGISTER_INI_ENTRIES();
     558       21049 :         return SUCCESS;
     559             : }
     560             : 
     561       21085 : PHP_MSHUTDOWN_FUNCTION(url_scanner)
     562             : {
     563       21085 :         UNREGISTER_INI_ENTRIES();
     564             : 
     565       21085 :         return SUCCESS;
     566             : }
     567             : 
     568       21006 : PHP_RINIT_FUNCTION(url_scanner)
     569             : {
     570       21006 :         BG(url_adapt_state_ex).active = 0;
     571             : 
     572       21006 :         return SUCCESS;
     573             : }
     574             : 
     575       21044 : PHP_RSHUTDOWN_FUNCTION(url_scanner)
     576             : {
     577       21044 :         if (BG(url_adapt_state_ex).active) {
     578          11 :                 php_url_scanner_ex_deactivate();
     579          11 :                 BG(url_adapt_state_ex).active = 0;
     580             :         }
     581             : 
     582             :         smart_str_free(&BG(url_adapt_state_ex).form_app);
     583             :         smart_str_free(&BG(url_adapt_state_ex).url_app);
     584             : 
     585       21044 :         return SUCCESS;
     586             : }

Generated by: LCOV version 1.10

Generated at Fri, 31 Jul 2015 08:59:03 +0000 (10 hours ago)

Copyright © 2005-2015 The PHP Group
All rights reserved.