开发者

View the actual $string processed by file_get_contents($string) in php

I'm forced to use an older version of php on a server, and it seems to have a bug in the function file_get_contents(); I believe it's a bug because the issue doesn't happen on the current version of php.

$string = 'intraneturl/?really_long_example_query_parameters';

When I pa开发者_如何学编程ss the $string into file_get_contents($string); the part with the query parameters seems to get truncated at some point because the returned information is different than when I run the exact same code on the up-to-date version of php on my dev machine.

My question is: How can I see the exact string that file_get_contents(); processed. I know what I sent in, but I don't believe it's processing it as I sent it. There may be a generic answer for viewing the innards of all functions via debugger or something. Do I need to use a debugger or is there a way to just print the information on the screen?


Install something like Wireshark and take a look at the actual http request sent over the network.


Install XDebug and e.g. netbeans as frontend to step through the php script code and inspect variables, function calls, ...


Compile the php version with the --debug option and use a native C debugger to step through the php engine's code. For the win32 builds on windows.php.net there are debug packs that contain debug symbols for the release build (those are less "accurate" than a "real" debug build due to optimization).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜