@@ -642,6 +642,10 @@ PHP_FUNCTION(pcntl_fork)
642
642
{
643
643
pid_t id ;
644
644
645
+ if (zend_parse_parameters_none () == FAILURE ) {
646
+ return ;
647
+ }
648
+
645
649
id = fork ();
646
650
if (id == -1 ) {
647
651
PCNTL_G (last_error ) = errno ;
@@ -658,10 +662,11 @@ PHP_FUNCTION(pcntl_alarm)
658
662
{
659
663
zend_long seconds ;
660
664
661
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & seconds ) == FAILURE )
665
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & seconds ) == FAILURE ) {
662
666
return ;
667
+ }
663
668
664
- RETURN_LONG ((zend_long ) alarm (seconds ));
669
+ RETURN_LONG ((zend_long ) alarm (seconds ));
665
670
}
666
671
/* }}} */
667
672
@@ -807,17 +812,17 @@ PHP_FUNCTION(pcntl_wait)
807
812
Returns true if the child status code represents a successful exit */
808
813
PHP_FUNCTION (pcntl_wifexited )
809
814
{
810
- #ifdef WIFEXITED
811
815
zend_long status_word ;
812
- int int_status_word ;
813
816
814
817
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
815
- return ;
818
+ return ;
816
819
}
817
820
818
- int_status_word = (int ) status_word ;
819
- if (WIFEXITED (int_status_word ))
821
+ #ifdef WIFEXITED
822
+ int int_status_word = (int ) status_word ;
823
+ if (WIFEXITED (int_status_word )) {
820
824
RETURN_TRUE ;
825
+ }
821
826
#endif
822
827
823
828
RETURN_FALSE ;
@@ -828,18 +833,19 @@ PHP_FUNCTION(pcntl_wifexited)
828
833
Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
829
834
PHP_FUNCTION (pcntl_wifstopped )
830
835
{
831
- #ifdef WIFSTOPPED
832
836
zend_long status_word ;
833
- int int_status_word ;
834
837
835
838
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
836
- return ;
839
+ return ;
837
840
}
838
841
839
- int_status_word = (int ) status_word ;
840
- if (WIFSTOPPED (int_status_word ))
842
+ #ifdef WIFSTOPPED
843
+ int int_status_word = (int ) status_word ;
844
+ if (WIFSTOPPED (int_status_word )) {
841
845
RETURN_TRUE ;
846
+ }
842
847
#endif
848
+
843
849
RETURN_FALSE ;
844
850
}
845
851
/* }}} */
@@ -848,36 +854,37 @@ PHP_FUNCTION(pcntl_wifstopped)
848
854
Returns true if the child status code represents a process that was terminated due to a signal */
849
855
PHP_FUNCTION (pcntl_wifsignaled )
850
856
{
851
- #ifdef WIFSIGNALED
852
857
zend_long status_word ;
853
- int int_status_word ;
854
858
855
859
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
856
- return ;
860
+ return ;
857
861
}
858
862
859
- int_status_word = (int ) status_word ;
860
- if (WIFSIGNALED (int_status_word ))
863
+ #ifdef WIFSIGNALED
864
+ int int_status_word = (int ) status_word ;
865
+ if (WIFSIGNALED (int_status_word )) {
861
866
RETURN_TRUE ;
867
+ }
862
868
#endif
869
+
863
870
RETURN_FALSE ;
864
871
}
865
872
/* }}} */
866
873
/* {{{ proto bool pcntl_wifcontinued(int status)
867
874
Returns true if the child status code represents a process that was resumed due to a SIGCONT signal */
868
875
PHP_FUNCTION (pcntl_wifcontinued )
869
876
{
870
- #ifdef HAVE_WCONTINUED
871
877
zend_long status_word ;
872
- int int_status_word ;
873
878
874
879
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
875
- return ;
880
+ return ;
876
881
}
877
882
878
- int_status_word = (int ) status_word ;
879
- if (WIFCONTINUED (int_status_word ))
883
+ #ifdef HAVE_WCONTINUED
884
+ int int_status_word = (int ) status_word ;
885
+ if (WIFCONTINUED (int_status_word )) {
880
886
RETURN_TRUE ;
887
+ }
881
888
#endif
882
889
RETURN_FALSE ;
883
890
}
@@ -888,15 +895,14 @@ PHP_FUNCTION(pcntl_wifcontinued)
888
895
Returns the status code of a child's exit */
889
896
PHP_FUNCTION (pcntl_wexitstatus )
890
897
{
891
- #ifdef WEXITSTATUS
892
898
zend_long status_word ;
893
- int int_status_word ;
894
899
895
900
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
896
- return ;
901
+ return ;
897
902
}
898
903
899
- int_status_word = (int ) status_word ;
904
+ #ifdef WEXITSTATUS
905
+ int int_status_word = (int ) status_word ;
900
906
RETURN_LONG (WEXITSTATUS (int_status_word ));
901
907
#else
902
908
RETURN_FALSE ;
@@ -908,15 +914,14 @@ PHP_FUNCTION(pcntl_wexitstatus)
908
914
Returns the number of the signal that terminated the process who's status code is passed */
909
915
PHP_FUNCTION (pcntl_wtermsig )
910
916
{
911
- #ifdef WTERMSIG
912
917
zend_long status_word ;
913
- int int_status_word ;
914
918
915
919
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
916
- return ;
920
+ return ;
917
921
}
918
922
919
- int_status_word = (int ) status_word ;
923
+ #ifdef WTERMSIG
924
+ int int_status_word = (int ) status_word ;
920
925
RETURN_LONG (WTERMSIG (int_status_word ));
921
926
#else
922
927
RETURN_FALSE ;
@@ -928,15 +933,14 @@ PHP_FUNCTION(pcntl_wtermsig)
928
933
Returns the number of the signal that caused the process to stop who's status code is passed */
929
934
PHP_FUNCTION (pcntl_wstopsig )
930
935
{
931
- #ifdef WSTOPSIG
932
936
zend_long status_word ;
933
- int int_status_word ;
934
937
935
938
if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & status_word ) == FAILURE ) {
936
- return ;
939
+ return ;
937
940
}
938
941
939
- int_status_word = (int ) status_word ;
942
+ #ifdef WSTOPSIG
943
+ int int_status_word = (int ) status_word ;
940
944
RETURN_LONG (WSTOPSIG (int_status_word ));
941
945
#else
942
946
RETURN_FALSE ;
@@ -1143,6 +1147,10 @@ PHP_FUNCTION(pcntl_signal_get_handler)
1143
1147
Dispatch signals to signal handlers */
1144
1148
PHP_FUNCTION (pcntl_signal_dispatch )
1145
1149
{
1150
+ if (zend_parse_parameters_none () == FAILURE ) {
1151
+ return ;
1152
+ }
1153
+
1146
1154
pcntl_signal_dispatch ();
1147
1155
RETURN_TRUE ;
1148
1156
}
@@ -1344,7 +1352,7 @@ PHP_FUNCTION(pcntl_getpriority)
1344
1352
int pri ;
1345
1353
1346
1354
if (zend_parse_parameters (ZEND_NUM_ARGS (), "|ll" , & pid , & who ) == FAILURE ) {
1347
- RETURN_FALSE ;
1355
+ return ;
1348
1356
}
1349
1357
1350
1358
/* needs to be cleared, since any returned value is valid */
@@ -1417,21 +1425,25 @@ PHP_FUNCTION(pcntl_setpriority)
1417
1425
Retrieve the error number set by the last pcntl function which failed. */
1418
1426
PHP_FUNCTION (pcntl_get_last_error )
1419
1427
{
1420
- RETURN_LONG (PCNTL_G (last_error ));
1428
+ if (zend_parse_parameters_none () == FAILURE ) {
1429
+ return ;
1430
+ }
1431
+
1432
+ RETURN_LONG (PCNTL_G (last_error ));
1421
1433
}
1422
1434
/* }}} */
1423
1435
1424
1436
/* {{{ proto string pcntl_strerror(int errno)
1425
1437
Retrieve the system error message associated with the given errno. */
1426
1438
PHP_FUNCTION (pcntl_strerror )
1427
1439
{
1428
- zend_long error ;
1440
+ zend_long error ;
1429
1441
1430
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & error ) == FAILURE ) {
1431
- RETURN_FALSE ;
1432
- }
1442
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "l" , & error ) == FAILURE ) {
1443
+ return ;
1444
+ }
1433
1445
1434
- RETURN_STRING (strerror (error ));
1446
+ RETURN_STRING (strerror (error ));
1435
1447
}
1436
1448
/* }}} */
1437
1449
@@ -1537,7 +1549,7 @@ void pcntl_signal_dispatch()
1537
1549
sigprocmask (SIG_SETMASK , & old_mask , NULL );
1538
1550
}
1539
1551
1540
- /* {{{ proto bool pcntl_async_signals([bool on[ )
1552
+ /* {{{ proto bool pcntl_async_signals([bool on] )
1541
1553
Enable/disable asynchronous signal handling and return the old setting. */
1542
1554
PHP_FUNCTION (pcntl_async_signals )
1543
1555
{
0 commit comments