3

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?

dnishiyama
  • 31
  • 1
  • phpdbg maintainer here; simple answer: no way to do this yet. … I've put this on the list of things to do soon, thanks :-) – bwoebi Oct 01 '16 at 13:29

1 Answers1

2

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
bwoebi
  • 23,637
  • 5
  • 58
  • 79