How can I read from STDIN while stepwise execution with phpdbg

111 Views Asked by At

Debugging a php script with phpdbg, how can I read from some data from STDIN ?

I am debugging a php script foo.php. foo.php reads from a line from STDIN when executed. I want to stepwise execute it with phpdbg.

I tried that

$ phpdbg foo.php
phpdbg> run < data.txt

but it doesn't work. data.txt contains some lines that I want to read from STDIN. Any suggestions?

1

There are 1 best solutions below

1
bwoebi On

Thanks a lot for your question, I've just implemented that in phpdbg. It will be available with 7.0.13.

For reference, the relevant git commit: http://git.php.net/?p=php-src.git;a=commitdiff;h=9d537951c5e4af5e453dd4d60e74dad039856b80

The syntax is exactly like you proposed:

r arg1 arg2 < file