Skip to content

Commit 69354fc

Browse files
committed
Update zend_API.c
1 parent 1bc92af commit 69354fc

1 file changed

Lines changed: 51 additions & 51 deletions

File tree

Zend/zend_API.c

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -458,26 +458,26 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **p
458458

459459
if (check_null && Z_TYPE_P(arg) == IS_NULL) {
460460
*pce = NULL;
461-
return 1;
461+
return true;
462462
}
463463
if (!try_convert_to_string(arg)) {
464464
*pce = NULL;
465-
return 0;
465+
return false;
466466
}
467467

468468
*pce = zend_lookup_class(Z_STR_P(arg));
469469
if (ce_base) {
470470
if ((!*pce || !instanceof_function(*pce, ce_base))) {
471471
zend_argument_type_error(num, "must be a class name derived from %s, %s given", ZSTR_VAL(ce_base->name), Z_STRVAL_P(arg));
472472
*pce = NULL;
473-
return 0;
473+
return false;
474474
}
475475
}
476476
if (!*pce) {
477477
zend_argument_type_error(num, "must be a valid class name, %s given", Z_STRVAL_P(arg));
478-
return 0;
478+
return false;
479479
}
480-
return 1;
480+
return true;
481481
}
482482
/* }}} */
483483

@@ -514,20 +514,20 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(const zval *arg, bool *dest
514514
{
515515
if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) {
516516
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("bool", arg_num)) {
517-
return 0;
517+
return false;
518518
}
519519
*dest = zend_is_true(arg);
520520
} else {
521-
return 0;
521+
return false;
522522
}
523-
return 1;
523+
return true;
524524
}
525525
/* }}} */
526526

527527
ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(const zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
528528
{
529529
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
530-
return 0;
530+
return false;
531531
}
532532
return zend_parse_arg_bool_weak(arg, dest, arg_num);
533533
}
@@ -536,7 +536,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(const zval *arg, bool *dest
536536
ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_bool_slow(const zval *arg, bool *dest, uint32_t arg_num)
537537
{
538538
if (UNEXPECTED(ZEND_FLF_ARG_USES_STRICT_TYPES())) {
539-
return 0;
539+
return false;
540540
}
541541
return zend_parse_arg_bool_weak(arg, dest, arg_num);
542542
}
@@ -545,10 +545,10 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
545545
{
546546
if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
547547
if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
548-
return 0;
548+
return false;
549549
}
550550
if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) {
551-
return 0;
551+
return false;
552552
} else {
553553
zend_long lval = zend_dval_to_lval(Z_DVAL_P(arg));
554554
if (UNEXPECTED(!zend_is_long_compatible(Z_DVAL_P(arg), lval))) {
@@ -558,7 +558,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
558558
zend_incompatible_double_to_long_error(Z_DVAL_P(arg));
559559
}
560560
if (UNEXPECTED(EG(exception))) {
561-
return 0;
561+
return false;
562562
}
563563
}
564564
*dest = lval;
@@ -571,10 +571,10 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
571571
if (EXPECTED(type != 0)) {
572572
zend_long lval;
573573
if (UNEXPECTED(zend_isnan(d))) {
574-
return 0;
574+
return false;
575575
}
576576
if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) {
577-
return 0;
577+
return false;
578578
}
579579

580580
lval = zend_dval_to_lval(d);
@@ -586,32 +586,32 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
586586
zend_incompatible_string_to_long_error(Z_STR_P(arg));
587587
}
588588
if (UNEXPECTED(EG(exception))) {
589-
return 0;
589+
return false;
590590
}
591591
}
592592
*dest = lval;
593593
} else {
594-
return 0;
594+
return false;
595595
}
596596
}
597597
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
598598
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) {
599-
return 0;
599+
return false;
600600
}
601601
*dest = 0;
602602
} else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
603603
*dest = 1;
604604
} else {
605-
return 0;
605+
return false;
606606
}
607-
return 1;
607+
return true;
608608
}
609609
/* }}} */
610610

611611
ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
612612
{
613613
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
614-
return 0;
614+
return false;
615615
}
616616
return zend_parse_arg_long_weak(arg, dest, arg_num);
617617
}
@@ -620,7 +620,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(const zval *arg, zend_long
620620
ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_long_slow(const zval *arg, zend_long *dest, uint32_t arg_num)
621621
{
622622
if (UNEXPECTED(ZEND_FLF_ARG_USES_STRICT_TYPES())) {
623-
return 0;
623+
return false;
624624
}
625625
return zend_parse_arg_long_weak(arg, dest, arg_num);
626626
}
@@ -637,20 +637,20 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double *
637637
if (EXPECTED(type != 0)) {
638638
*dest = (double)(l);
639639
} else {
640-
return 0;
640+
return false;
641641
}
642642
}
643643
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
644644
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("float", arg_num)) {
645-
return 0;
645+
return false;
646646
}
647647
*dest = 0.0;
648648
} else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
649649
*dest = 1.0;
650650
} else {
651-
return 0;
651+
return false;
652652
}
653-
return 1;
653+
return true;
654654
}
655655
/* }}} */
656656

@@ -660,7 +660,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(const zval *arg, double *
660660
/* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */
661661
*dest = (double)Z_LVAL_P(arg);
662662
} else if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
663-
return 0;
663+
return false;
664664
}
665665
return zend_parse_arg_double_weak(arg, dest, arg_num);
666666
}
@@ -669,7 +669,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(const zval *arg, double *
669669
ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, uint32_t arg_num) /* {{{ */
670670
{
671671
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
672-
return 0;
672+
return false;
673673
}
674674
if (Z_TYPE_P(arg) == IS_STRING) {
675675
zend_string *str = Z_STR_P(arg);
@@ -681,21 +681,21 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, u
681681
} else if (type == IS_DOUBLE) {
682682
ZVAL_DOUBLE(arg, dval);
683683
} else {
684-
return 0;
684+
return false;
685685
}
686686
zend_string_release(str);
687687
} else if (Z_TYPE_P(arg) < IS_TRUE) {
688688
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int|float", arg_num)) {
689-
return 0;
689+
return false;
690690
}
691691
ZVAL_LONG(arg, 0);
692692
} else if (Z_TYPE_P(arg) == IS_TRUE) {
693693
ZVAL_LONG(arg, 1);
694694
} else {
695-
return 0;
695+
return false;
696696
}
697697
*dest = arg;
698-
return 1;
698+
return true;
699699
}
700700
/* }}} */
701701

@@ -733,7 +733,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **des
733733
{
734734
if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) {
735735
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("string", arg_num)) {
736-
return 0;
736+
return false;
737737
}
738738
convert_to_string(arg);
739739
*dest = Z_STR_P(arg);
@@ -744,20 +744,20 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **des
744744
OBJ_RELEASE(zobj);
745745
ZVAL_COPY_VALUE(arg, &obj);
746746
*dest = Z_STR_P(arg);
747-
return 1;
747+
return true;
748748
}
749-
return 0;
749+
return false;
750750
} else {
751-
return 0;
751+
return false;
752752
}
753-
return 1;
753+
return true;
754754
}
755755
/* }}} */
756756

757757
ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest, uint32_t arg_num) /* {{{ */
758758
{
759759
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
760-
return 0;
760+
return false;
761761
}
762762
return zend_parse_arg_str_weak(arg, dest, arg_num);
763763
}
@@ -766,24 +766,24 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **des
766766
ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_str_slow(zval *arg, zend_string **dest, uint32_t arg_num)
767767
{
768768
if (UNEXPECTED(ZEND_FLF_ARG_USES_STRICT_TYPES())) {
769-
return 0;
769+
return false;
770770
}
771771
return zend_parse_arg_str_weak(arg, dest, arg_num);
772772
}
773773

774774
ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long, uint32_t arg_num) /* {{{ */
775775
{
776776
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
777-
return 0;
777+
return false;
778778
}
779779
if (zend_parse_arg_long_weak(arg, dest_long, arg_num)) {
780780
*dest_str = NULL;
781-
return 1;
781+
return true;
782782
} else if (zend_parse_arg_str_weak(arg, dest_str, arg_num)) {
783783
*dest_long = 0;
784-
return 1;
784+
return true;
785785
} else {
786-
return 0;
786+
return false;
787787
}
788788
}
789789
/* }}} */
@@ -3842,7 +3842,7 @@ static zend_always_inline bool zend_is_callable_check_func(const zval *callable,
38423842

38433843
if (colon == Z_STRVAL_P(callable)) {
38443844
if (error) *error = estrdup("invalid function name");
3845-
return 0;
3845+
return false;
38463846
}
38473847

38483848
/* This is a compound name.
@@ -3873,14 +3873,14 @@ static zend_always_inline bool zend_is_callable_check_func(const zval *callable,
38733873
strict_class = true;
38743874
} else if (!zend_is_callable_check_class(cname, scope, frame, fcc, &strict_class, error, suppress_deprecation || ce_org != NULL)) {
38753875
zend_string_release_ex(cname, 0);
3876-
return 0;
3876+
return false;
38773877
}
38783878
zend_string_release_ex(cname, 0);
38793879

38803880
ftable = &fcc->calling_scope->function_table;
38813881
if (ce_org && !instanceof_function(ce_org, fcc->calling_scope)) {
38823882
if (error) zend_spprintf(error, 0, "class %s is not a subclass of %s", ZSTR_VAL(ce_org->name), ZSTR_VAL(fcc->calling_scope->name));
3883-
return 0;
3883+
return false;
38843884
}
38853885
if (ce_org && !suppress_deprecation) {
38863886
zend_error(E_DEPRECATED,
@@ -3899,7 +3899,7 @@ static zend_always_inline bool zend_is_callable_check_func(const zval *callable,
38993899
if (error) {
39003900
zend_spprintf(error, 0, "function \"%s\" not found or invalid function name", Z_STRVAL_P(callable));
39013901
}
3902-
return 0;
3902+
return false;
39033903
}
39043904

39053905
lmname = zend_string_tolower(mname);
@@ -4164,11 +4164,11 @@ ZEND_API bool zend_is_callable_at_frame(
41644164

41654165
if (Z_TYPE_P(obj) == IS_STRING) {
41664166
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
4167-
return 1;
4167+
return true;
41684168
}
41694169

41704170
if (!zend_is_callable_check_class(Z_STR_P(obj), get_scope(frame), frame, fcc, &strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS)) {
4171-
return 0;
4171+
return false;
41724172
}
41734173
} else {
41744174
ZEND_ASSERT(Z_TYPE_P(obj) == IS_OBJECT);
@@ -4177,14 +4177,14 @@ ZEND_API bool zend_is_callable_at_frame(
41774177

41784178
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
41794179
fcc->called_scope = fcc->calling_scope;
4180-
return 1;
4180+
return true;
41814181
}
41824182
}
41834183

41844184
callable = method;
41854185
goto check_func;
41864186
}
4187-
return 0;
4187+
return false;
41884188
case IS_OBJECT:
41894189
if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object, 1) == SUCCESS) {
41904190
fcc->called_scope = fcc->calling_scope;

0 commit comments

Comments
 (0)