Hello
prehistory:
i tried to use php_str_to_str function to replace some character
insteed of use call_user_func with str_replace
in ext/standard/string.c
PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char
*needle, size_t needle_len, char *str, size_t str_len);
so i expect a zend_string as result ?
but when i build i got a warning: assignment makes pointer from integer
without a cast
buf = php_str_to_str(value,strlen(value),"y",1,"J",1);
^
buf is: zend_string *buf;
When buf is: int buf; i got no warning.
i found 2 examples which looks like i have done
ext/standard/var.c
win32/sendmail.c
Best Regards
Torsten
On Wed, Feb 8, 2017 at 2:02 PM, Torsten Rosenberger rosenberger@taoweb.at
wrote:
Hello
prehistory:
i tried to use php_str_to_str function to replace some character
insteed of use call_user_func with str_replacein ext/standard/string.c
PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char
*needle, size_t needle_len, char *str, size_t str_len);so i expect a zend_string as result ?
but when i build i got a warning: assignment makes pointer from integer
without a castbuf = php_str_to_str(value,strlen(value),"y",1,"J",1);
^
buf is: zend_string *buf;
When buf is: int buf; i got no warning.i found 2 examples which looks like i have done
ext/standard/var.c
win32/sendmail.c
You probably forgot to include the header declaring this function. If C
does not have the declaration for a function, it assumes that it returns
int.
Nikita
Am Mittwoch, den 08.02.2017, 14:16 +0100 schrieb Nikita Popov:
On Wed, Feb 8, 2017 at 2:02 PM, Torsten Rosenberger <rosenberger@taow
eb.at>
wrote:Hello
prehistory:
i tried to use php_str_to_str function to replace some character
insteed of use call_user_func with str_replacein ext/standard/string.c
PHPAPI zend_string *php_str_to_str(char *haystack, size_t length,
char
*needle, size_t needle_len, char *str, size_t str_len);so i expect a zend_string as result ?
but when i build i got a warning: assignment makes pointer from
integer
without a castbuf = php_str_to_str(value,strlen(value),"y",1,"J",1);
^
buf is: zend_string *buf;
When buf is: int buf; i got no warning.i found 2 examples which looks like i have done
ext/standard/var.c
win32/sendmail.cYou probably forgot to include the header declaring this function. If
C
does not have the declaration for a function, it assumes that it
returns
int.
thank's
cannot see the wood for the trees
know it works but with
buf = php_str_to_str(value, value_len, "'", 1, "\x27", 4);
i get a segfault
buf = php_str_to_str(value, value_len, "'", 1, "\x2", 3);
works but not as i like
i want to build a js escape function
<script type='javascript'></script> should become <script type=\x27javascript\x27></script>an so on
BR/Torsten