title: PHP pcntl_wait() does not wait for child exit
body: <p>I have a php script that forks and parent calls pnctl_wait(). According to php manual pcntl_wait() should suspend execution of the current process until a child has exited. But this does not happen. 
  The parent process does not wait at all and executes the next line immediately. </p>
  
  <p>I have tried to replicate the issue in a small sample script below</p>
  
  <pre><code>&lt;?php
  $parentpid=getmypid();
  declare(ticks=1);
  $apid = pcntl_fork();
  if ($apid == -1) {
    die('could not fork for client '.$client);
   } else if ($apid) {     //parent                                                                                                              
  
  
  pcntl_wait($status,WNOHANG); //Protect against Zombie children                                                                     
  /* Parent does not wait here */ 
  
    print "PARENT $parentpid has forked $apid \n";   
  
    sleep(100);
   } else { // child                                                                                                                             
    $pid = getmypid();
    print "CHILD $pid  is sleeping\n";
    sleep(40);
   }
  
  
  ?&gt;
  </code></pre>