|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18804 PCNTL variable conflict PARENT-CHILD
Submitted: 2002-08-08 09:50 UTC Modified: 2002-08-08 09:56 UTC
From: bariou at brasnah dot com Assigned:
Status: Not a bug Package: POSIX related
PHP Version: 4.2.2 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bariou at brasnah dot com
New email:
PHP Version: OS:


 [2002-08-08 09:50 UTC] bariou at brasnah dot com
I can be wrong, but When I make a fork() ($pid=pcntl_fork())the only difference for the child and parent process is the $pid value. Both process have the same memory image, credentials, open files, signal handlers and by the way the same variables. It's not thrue with PCNTL I dont know for other langages, for exemple try the following test program => The parent has two variables $a and $b. If I make a change in the child, this change has no impact on the parent.

Tell me where I'm wrong. Thanks for your help


The example for test :


	function sig_handler($signo) {
	         case SIGINT:
	             $msg=  "STOP THE WAR\n";
	         case SIGHUP:
	             // handle restart tasks
	         case SIGCHLD:
	             while( pcntl_waitpid(-1,$status,WNOHANG)>0 ) {}
	             // handle all other signals
	pcntl_signal(SIGCHLD, "sig_handler");
	pcntl_signal(SIGHUP, "sig_handler");
	pcntl_signal(SIGINT, "sig_handler");
		echo "\SEPARATOR";
		echo "\n I'am the parent C1=> $c ";
	        print "failure\n";}
			print "\nI AM THE CHILD C in child => $c";
	    print "\n I'm the parent  C2=> ".$c;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-08 09:56 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

please read the fork man page - fork normally copies all the data from the running process, so your new thread is a copy (not the same data)..
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 19:01:29 2024 UTC