Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于字符串中的'\0'字符 #3

Closed
wangchuan3533 opened this issue Jul 26, 2013 · 1 comment
Closed

关于字符串中的'\0'字符 #3

wangchuan3533 opened this issue Jul 26, 2013 · 1 comment

Comments

@wangchuan3533
Copy link
Contributor

你好,
请问在传输的字符串中插入'\0'字符或者或者其他特殊字符可以吗
我在测试时发现如果传输的字符串中包含'\0'字符就会被截断,后面的内容就不会传输了
比如发送的是:"abcdef\00ABCDEF"
接收到的就只有:"abcdef"
但是利用strlen计算,发送端的长度为13,接收端得到的长度为6
不知道是我的编译环境的问题还是php语言本身的设定就是这样,本人刚学php,好多东西都不懂~

@matyhtf
Copy link
Member

matyhtf commented Jul 29, 2013

swoole支持二进制传输,PHP的string函数也是二进制安全的。
图片可是用file_get_contents读取然后直接发送。

\0没有收到数据是客户端代码swoole_client类的一个bug,漏传长度。现已解决,请git pull代码重新测试下

@matyhtf matyhtf closed this as completed Jul 29, 2013
@diida diida mentioned this issue Jul 28, 2015
@benzhan benzhan mentioned this issue Jan 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants