@@ -1497,8 +1497,8 @@ PHP_FUNCTION(openssl_x509_export_to_file)
14971497
14981498 cert = php_openssl_x509_from_param (cert_obj , cert_str );
14991499 if (cert == NULL ) {
1500- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
1501- RETURN_THROWS () ;
1500+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
1501+ return ;
15021502 }
15031503
15041504 if (php_openssl_open_base_dir_chk (filename )) {
@@ -1811,8 +1811,8 @@ PHP_FUNCTION(openssl_x509_export)
18111811
18121812 cert = php_openssl_x509_from_param (cert_obj , cert_str );
18131813 if (cert == NULL ) {
1814- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
1815- RETURN_THROWS () ;
1814+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
1815+ return ;
18161816 }
18171817
18181818 bio_out = BIO_new (BIO_s_mem ());
@@ -1889,8 +1889,8 @@ PHP_FUNCTION(openssl_x509_fingerprint)
18891889
18901890 cert = php_openssl_x509_from_param (cert_obj , cert_str );
18911891 if (cert == NULL) {
1892- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
1893- RETURN_THROWS () ;
1892+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
1893+ RETURN_FALSE ;
18941894 }
18951895
18961896 fingerprint = php_openssl_x509_fingerprint (cert , method , raw_output );
@@ -2087,8 +2087,8 @@ PHP_FUNCTION(openssl_x509_parse)
20872087
20882088 cert = php_openssl_x509_from_param (cert_obj , cert_str );
20892089 if (cert == NULL ) {
2090- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
2091- RETURN_THROWS () ;
2090+ // TODO Add Warning?
2091+ RETURN_FALSE ;
20922092 }
20932093 array_init (return_value );
20942094
@@ -2348,7 +2348,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose)
23482348 }
23492349 cert = php_openssl_x509_from_param (cert_obj , cert_str );
23502350 if (cert == NULL ) {
2351- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
2351+ // TODO Add Warning?
23522352 goto clean_exit ;
23532353 }
23542354
@@ -2455,8 +2455,8 @@ PHP_FUNCTION(openssl_x509_read)
24552455
24562456 cert = php_openssl_x509_from_param (cert_obj , cert_str );
24572457 if (cert == NULL ) {
2458- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
2459- RETURN_THROWS () ;
2458+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
2459+ RETURN_FALSE ;
24602460 }
24612461
24622462 object_init_ex (return_value , php_openssl_certificate_ce );
@@ -2504,7 +2504,7 @@ static STACK_OF(X509) * php_array_to_X509_sk(zval * zcerts) /* {{{ */
25042504 ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (zcerts ), zcertval ) {
25052505 cert = php_openssl_x509_from_zval (zcertval , & free_cert );
25062506 if (cert == NULL ) {
2507- // TODO Add ValueError ?
2507+ // TODO Add Warning ?
25082508 goto clean_exit ;
25092509 }
25102510
@@ -2524,7 +2524,7 @@ static STACK_OF(X509) * php_array_to_X509_sk(zval * zcerts) /* {{{ */
25242524 cert = php_openssl_x509_from_zval (zcerts , & free_cert );
25252525
25262526 if (cert == NULL ) {
2527- // TODO Add ValueError ?
2527+ // TODO Add Warning ?
25282528 goto clean_exit ;
25292529 }
25302530
@@ -2575,8 +2575,8 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
25752575
25762576 cert = php_openssl_x509_from_param (cert_obj , cert_str );
25772577 if (cert == NULL) {
2578- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
2579- RETURN_THROWS () ;
2578+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
2579+ return ;
25802580 }
25812581
25822582 priv_key = php_openssl_pkey_from_zval (zpkey , 0 , "" , 0 , & free_pkey );
@@ -2678,8 +2678,8 @@ PHP_FUNCTION(openssl_pkcs12_export)
26782678
26792679 cert = php_openssl_x509_from_param (cert_obj , cert_str );
26802680 if (cert == NULL ) {
2681- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate" );
2682- RETURN_THROWS () ;
2681+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
2682+ return ;
26832683 }
26842684
26852685 priv_key = php_openssl_pkey_from_zval (zpkey , 0 , "" , 0 , & free_pkey );
@@ -3088,8 +3088,8 @@ PHP_FUNCTION(openssl_csr_export_to_file)
30883088
30893089 csr = php_openssl_csr_from_param (csr_obj , csr_str );
30903090 if (csr == NULL ) {
3091- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate Signing Request" );
3092- RETURN_THROWS () ;
3091+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate Signing Request cannot be retrieved " );
3092+ return ;
30933093 }
30943094
30953095 if (php_openssl_open_base_dir_chk (filename )) {
@@ -3140,8 +3140,8 @@ PHP_FUNCTION(openssl_csr_export)
31403140
31413141 csr = php_openssl_csr_from_param (csr_obj , csr_str );
31423142 if (csr == NULL ) {
3143- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate Signing Request" );
3144- RETURN_THROWS () ;
3143+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate Signing Request cannot be retrieved " );
3144+ return ;
31453145 }
31463146
31473147 /* export to a var */
@@ -3202,16 +3202,16 @@ PHP_FUNCTION(openssl_csr_sign)
32023202
32033203 csr = php_openssl_csr_from_param (csr_obj , csr_str );
32043204 if (csr == NULL) {
3205- zend_argument_type_error ( 1 , "cannot be coerced into an X.509 Certificate Signing Request" );
3206- RETURN_THROWS () ;
3205+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate Signing Request cannot be retrieved " );
3206+ return ;
32073207 }
32083208
32093209 PHP_SSL_REQ_INIT (& req );
32103210
32113211 if (cert_str || cert_obj ) {
32123212 cert = php_openssl_x509_from_param (cert_obj , cert_str );
32133213 if (cert == NULL ) {
3214- zend_argument_type_error ( 2 , "cannot be coerced into an X.509 Certificate" );
3214+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
32153215 goto cleanup ;
32163216 }
32173217 }
@@ -5072,7 +5072,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
50725072
50735073 cert = php_openssl_x509_from_zval (zcertval , & free_cert );
50745074 if (cert == NULL ) {
5075- zend_argument_value_error ( 3 , "must be a valid X.509 Certificate" );
5075+ // TODO Add warning?
50765076 goto clean_exit ;
50775077 }
50785078
@@ -5093,7 +5093,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
50935093
50945094 cert = php_openssl_x509_from_zval (zrecipcerts , & free_cert );
50955095 if (cert == NULL ) {
5096- zend_argument_value_error ( 3 , "must be a valid X.509 Certificate" );
5096+ // TODO Add warning?
50975097 goto clean_exit ;
50985098 }
50995099
@@ -5315,7 +5315,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
53155315
53165316 cert = php_openssl_x509_from_param (cert_obj , cert_str );
53175317 if (cert == NULL ) {
5318- zend_argument_type_error ( 3 , "cannot be coerced into an X.509 Certificate" );
5318+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
53195319 goto clean_exit ;
53205320 }
53215321
@@ -5418,7 +5418,7 @@ PHP_FUNCTION(openssl_pkcs7_decrypt)
54185418
54195419 cert = php_openssl_x509_from_zval (recipcert , & free_recipcert );
54205420 if (cert == NULL ) {
5421- zend_argument_type_error ( 3 , "cannot be coerced into an X.509 Certificate" );
5421+ php_error_docref ( NULL , E_WARNING , " X.509 Certificate cannot be retrieved " );
54225422 goto clean_exit ;
54235423 }
54245424
0 commit comments