开发者

Different output from exec if using a mobile browser

开发者 https://www.devze.com 2023-03-27 09:54 出处:网络
This one has me stumped. I have two Windows installations of PHP: 32-bit on a 32-bit OS, and 64-bit on a 64-bit OS. Both use Apache 2.2 (native architectures), and both load php as a module.

This one has me stumped. I have two Windows installations of PHP: 32-bit on a 32-bit OS, and 64-bit on a 64-bit OS. Both use Apache 2.2 (native architectures), and both load php as a module.

Then I have a console application (.Net), which outputs one line with stuff in it. Typically, it will output one word, like E_INVALID_CREDENTIALS, or S_SUCCESS, (custom codes), followed by a colon and random data.

I am using $e开发者_JS百科 = exec("command") in PHP and parsing the output of $e. However, and I have tested this with a die($e) after the exec statement, if I use a mobile browser (iPod touch, or Android 2.2), the output of exec is just the first word and a colon, but if I use a desktop browser (Chrome, or Firefox), the output is the complete line as printed by the console application.

I have run the command manually, even printed the command PHP is executing, and I see no reason for truncated output.

Can anyone help me root out this problem?


PHP is server-side, thus it does not have any connection, if you're not checking user's agent and other client-side information.

If you're really getting different information, be sure your browsers both use same settings (cookies enabled, for example)

But it all depends on your dependencies from code-side and from code as a whole.

Maybe there is everything visible, but you have just wrong CSS or something so it appears differently on different browsers (?)


Finally. After a few days of debugging, I realized that the username I was sending to the console application was capitalized for mobile browsers. And while a capitalized username did not throw an error, it failed in other, mysterious ways.I should have caught this earlier. Either way, this was an esoteric bug in the Console Application, and had nothing to do with PHP. I still blame the phones for capitalizing my username...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号