php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55018 Missing semicolon from the end of the example script
Submitted: 2011-06-09 18:17 UTC Modified: 2011-06-09 19:15 UTC
From: pgl at yoyo dot org Assigned: rquadling (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pgl at yoyo dot org
New email:
PHP Version: OS:

 

 [2011-06-09 18:17 UTC] pgl at yoyo dot org
Description:
------------
---
From manual page: http://www.php.net/function.pcntl-signal#Examples
---

There is a missing semicolon from the end of the example script on the pcntl_signal man page.

This line specifically:

echo "Done\n"

needs ; at the end.


Test script:
---------------
<?php
// tick use required as of PHP 4.3.0
declare(ticks = 1);

// signal handler function
function sig_handler($signo)
{

     switch ($signo) {
         case SIGTERM:
             // handle shutdown tasks
             exit;
             break;
         case SIGHUP:
             // handle restart tasks
             break;
         case SIGUSR1:
             echo "Caught SIGUSR1...\n";
             break;
         default:
             // handle all other signals
     }

}

echo "Installing signal handler...\n";

// setup signal handlers
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP,  "sig_handler");
pcntl_signal(SIGUSR1, "sig_handler");

// or use an object, available as of PHP 4.3.0
// pcntl_signal(SIGUSR1, array($obj, "do_something");

echo"Generating signal SIGTERM to self...\n";

// send SIGUSR1 to current process id
posix_kill(posix_getpid(), SIGUSR1);

echo "Done\n"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-09 19:15 UTC] rquadling@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311978
Log: Missing ;
Fix bug#55018
 [2011-06-09 19:15 UTC] rquadling@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rquadling
 [2011-06-09 19:15 UTC] rquadling@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 13:00:02 2026 UTC