@@ -46,7 +46,7 @@ static void php_url_encode_scalar(zval *scalar, smart_str *form_str,
4646 smart_str_append_long (form_str , index_int );
4747 }
4848 if (key_prefix ) {
49- smart_str_appendl (form_str , "%5D" , strlen ("%5D" ));
49+ smart_str_appendl (form_str , "%5D" , sizeof ("%5D" ) - 1 );
5050 }
5151 smart_str_appendc (form_str , '=' );
5252
@@ -170,9 +170,9 @@ PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
170170 }
171171
172172 if (key_prefix ) {
173- new_prefix = zend_string_concat3 (ZSTR_VAL (key_prefix ), ZSTR_LEN (key_prefix ), ZSTR_VAL (encoded_key ), ZSTR_LEN (encoded_key ), "%5D%5B" , strlen ("%5D%5B" ));
173+ new_prefix = zend_string_concat3 (ZSTR_VAL (key_prefix ), ZSTR_LEN (key_prefix ), ZSTR_VAL (encoded_key ), ZSTR_LEN (encoded_key ), "%5D%5B" , sizeof ("%5D%5B" ) - 1 );
174174 } else {
175- new_prefix = zend_string_concat2 (ZSTR_VAL (encoded_key ), ZSTR_LEN (encoded_key ), "%5B" , strlen ("%5B" ));
175+ new_prefix = zend_string_concat2 (ZSTR_VAL (encoded_key ), ZSTR_LEN (encoded_key ), "%5B" , sizeof ("%5B" ) - 1 );
176176 }
177177 zend_string_efree (encoded_key );
178178 } else { /* is integer index */
@@ -183,20 +183,20 @@ PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
183183
184184 if (key_prefix && num_prefix ) {
185185 /* zend_string_concat4() */
186- size_t len = ZSTR_LEN (key_prefix ) + num_prefix_len + index_int_as_str_len + strlen ("%5D%5B" );
186+ size_t len = ZSTR_LEN (key_prefix ) + num_prefix_len + index_int_as_str_len + sizeof ("%5D%5B" ) - 1 ;
187187 new_prefix = zend_string_alloc (len , 0 );
188188
189189 memcpy (ZSTR_VAL (new_prefix ), ZSTR_VAL (key_prefix ), ZSTR_LEN (key_prefix ));
190190 memcpy (ZSTR_VAL (new_prefix ) + ZSTR_LEN (key_prefix ), num_prefix , num_prefix_len );
191191 memcpy (ZSTR_VAL (new_prefix ) + ZSTR_LEN (key_prefix ) + num_prefix_len , index_int_as_str , index_int_as_str_len );
192- memcpy (ZSTR_VAL (new_prefix ) + ZSTR_LEN (key_prefix ) + num_prefix_len + index_int_as_str_len , "%5D%5B" , strlen ("%5D%5B" ));
192+ memcpy (ZSTR_VAL (new_prefix ) + ZSTR_LEN (key_prefix ) + num_prefix_len + index_int_as_str_len , "%5D%5B" , sizeof ("%5D%5B" ) - 1 );
193193 ZSTR_VAL (new_prefix )[len ] = '\0' ;
194194 } else if (key_prefix ) {
195- new_prefix = zend_string_concat3 (ZSTR_VAL (key_prefix ), ZSTR_LEN (key_prefix ), index_int_as_str , index_int_as_str_len , "%5D%5B" , strlen ("%5D%5B" ));
195+ new_prefix = zend_string_concat3 (ZSTR_VAL (key_prefix ), ZSTR_LEN (key_prefix ), index_int_as_str , index_int_as_str_len , "%5D%5B" , sizeof ("%5D%5B" ) - 1 );
196196 } else if (num_prefix ) {
197- new_prefix = zend_string_concat3 (num_prefix , num_prefix_len , index_int_as_str , index_int_as_str_len , "%5B" , strlen ("%5B" ));
197+ new_prefix = zend_string_concat3 (num_prefix , num_prefix_len , index_int_as_str , index_int_as_str_len , "%5B" , sizeof ("%5B" ) - 1 );
198198 } else {
199- new_prefix = zend_string_concat2 (index_int_as_str , index_int_as_str_len , "%5B" , strlen ("%5B" ));
199+ new_prefix = zend_string_concat2 (index_int_as_str , index_int_as_str_len , "%5B" , sizeof ("%5B" ) - 1 );
200200 }
201201 efree (index_int_as_str );
202202 }
0 commit comments