1

0

I am trying to debug php CLI using Zend Studio. My problem: I can't get user input from keyboard.

This is part of code (method in some class):

public function getInput($promt = null, $defaultValue = null) {
    if(!isset($promt)){
        $promt = self::$DEFAULT_PROMPT;
    }
    echo $promt;
    $stdin = fopen ( "php://stdin", "r" );  
    $val = fgets ( $stdin );
    return $val;
}

So ZS walks through code quite ok, but it stops at $val=fgets() And I have no clue where am I supposed to enter something from keyboard. I tried in console, and everywhere, I chacked debug configuration (Allocate console = on) etc.

HELP!

Charles
  • 50,943
  • 13
  • 104
  • 142
Yuriy
  • 101
  • 1
  • 8
  • Have you tried "echo foo | program" just to see what's going on? –  Jun 02 '10 at 17:20
  • From what I've found so far, the fopen() is causing the debug session to hang, as it's treating the process as a stream. I've not figured out how to force an EOF marker or a way to truncate the stream yet. – allnightgrocery Jun 02 '10 at 23:25
  • echo works quite ok. the problem is how to get input. Seems ZS does not support typing in the console at all, so fopen(STDIN) hangs. – Yuriy Jun 03 '10 at 17:38

0 Answers0