@@ -1310,7 +1310,7 @@ PHP_FUNCTION(time_sleep_until)
1310
1310
target_ns = (uint64_t ) (target_secs * ns_per_sec );
1311
1311
current_ns = ((uint64_t ) tm .tv_sec ) * ns_per_sec + ((uint64_t ) tm .tv_usec ) * 1000 ;
1312
1312
if (target_ns < current_ns ) {
1313
- php_error_docref (NULL , E_WARNING , "Sleep until to time is less than current time" );
1313
+ php_error_docref (NULL , E_WARNING , "Argument #1 ($timestamp) must be greater than or equal to the current time" );
1314
1314
RETURN_FALSE ;
1315
1315
}
1316
1316
@@ -1468,9 +1468,8 @@ PHPAPI int _php_error_log_ex(int opt_err, const char *message, size_t message_le
1468
1468
break ;
1469
1469
1470
1470
case 2 : /*send to an address */
1471
- php_error_docref ( NULL , E_WARNING , "TCP/IP option not available! " );
1471
+ zend_value_error ( "TCP/IP option is not available for error logging " );
1472
1472
return FAILURE ;
1473
- break ;
1474
1473
1475
1474
case 3 : /*save to a file */
1476
1475
stream = php_stream_open_wrapper (opt , "a" , IGNORE_URL_WIN | REPORT_ERRORS , NULL );
@@ -1684,10 +1683,9 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */
1684
1683
zval retval ;
1685
1684
1686
1685
if (!zend_is_callable (& shutdown_function_entry -> arguments [0 ], 0 , NULL )) {
1687
- zend_string * function_name
1688
- = zend_get_callable_name (& shutdown_function_entry -> arguments [0 ]);
1689
- php_error (E_WARNING , "(Registered shutdown functions) Unable to call %s() - function does not exist" , ZSTR_VAL (function_name ));
1690
- zend_string_release_ex (function_name , 0 );
1686
+ zend_string * function_name = zend_get_callable_name (& shutdown_function_entry -> arguments [0 ]);
1687
+ zend_throw_error (NULL , "Registered shutdown function %s() cannot be called, function does not exist" , ZSTR_VAL (function_name ));
1688
+ zend_string_release (function_name );
1691
1689
return 0 ;
1692
1690
}
1693
1691
@@ -1719,21 +1717,10 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe) /* {{{ */
1719
1717
tick_fe -> arguments + 1
1720
1718
) == SUCCESS ) {
1721
1719
zval_ptr_dtor (& retval );
1722
-
1723
1720
} else {
1724
- zval * obj , * method ;
1725
-
1726
- if (Z_TYPE_P (function ) == IS_STRING ) {
1727
- php_error_docref (NULL , E_WARNING , "Unable to call %s() - function does not exist" , Z_STRVAL_P (function ));
1728
- } else if ( Z_TYPE_P (function ) == IS_ARRAY
1729
- && (obj = zend_hash_index_find (Z_ARRVAL_P (function ), 0 )) != NULL
1730
- && (method = zend_hash_index_find (Z_ARRVAL_P (function ), 1 )) != NULL
1731
- && Z_TYPE_P (obj ) == IS_OBJECT
1732
- && Z_TYPE_P (method ) == IS_STRING ) {
1733
- php_error_docref (NULL , E_WARNING , "Unable to call %s::%s() - function does not exist" , ZSTR_VAL (Z_OBJCE_P (obj )-> name ), Z_STRVAL_P (method ));
1734
- } else {
1735
- php_error_docref (NULL , E_WARNING , "Unable to call tick function" );
1736
- }
1721
+ zend_string * function_name = zend_get_callable_name (function );
1722
+ zend_throw_error (NULL , "Registered tick function %s() cannot be called, function does not exist" , ZSTR_VAL (function_name ));
1723
+ zend_string_release (function_name );
1737
1724
}
1738
1725
1739
1726
tick_fe -> calling = 0 ;
@@ -1764,7 +1751,7 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_
1764
1751
}
1765
1752
1766
1753
if (ret && tick_fe1 -> calling ) {
1767
- php_error_docref (NULL , E_WARNING , "Unable to delete tick function executed at the moment " );
1754
+ zend_throw_error (NULL , "Registered tick function cannot be unregistered while it is being executed " );
1768
1755
return 0 ;
1769
1756
}
1770
1757
return ret ;
@@ -1818,23 +1805,22 @@ PHP_FUNCTION(register_shutdown_function)
1818
1805
1819
1806
/* Prevent entering of anything but valid callback (syntax check only!) */
1820
1807
if (!zend_is_callable (& shutdown_function_entry .arguments [0 ], 0 , NULL )) {
1821
- zend_string * callback_name
1822
- = zend_get_callable_name (& shutdown_function_entry .arguments [0 ]);
1823
- php_error_docref (NULL , E_WARNING , "Invalid shutdown callback '%s' passed" , ZSTR_VAL (callback_name ));
1808
+ zend_string * callback_name = zend_get_callable_name (& shutdown_function_entry .arguments [0 ]);
1809
+ zend_argument_type_error (1 , "must be a valid callback, function \"%s\" not found or invalid function name" , ZSTR_VAL (callback_name ));
1824
1810
efree (shutdown_function_entry .arguments );
1825
- zend_string_release_ex (callback_name , 0 );
1826
- RETVAL_FALSE ;
1827
- } else {
1828
- if (!BG (user_shutdown_function_names )) {
1829
- ALLOC_HASHTABLE (BG (user_shutdown_function_names ));
1830
- zend_hash_init (BG (user_shutdown_function_names ), 0 , NULL , user_shutdown_function_dtor , 0 );
1831
- }
1811
+ zend_string_release (callback_name );
1812
+ RETURN_THROWS ();
1813
+ }
1832
1814
1833
- for (i = 0 ; i < shutdown_function_entry .arg_count ; i ++ ) {
1834
- Z_TRY_ADDREF (shutdown_function_entry .arguments [i ]);
1835
- }
1836
- zend_hash_next_index_insert_mem (BG (user_shutdown_function_names ), & shutdown_function_entry , sizeof (php_shutdown_function_entry ));
1815
+ if (!BG (user_shutdown_function_names )) {
1816
+ ALLOC_HASHTABLE (BG (user_shutdown_function_names ));
1817
+ zend_hash_init (BG (user_shutdown_function_names ), 0 , NULL , user_shutdown_function_dtor , 0 );
1818
+ }
1819
+
1820
+ for (i = 0 ; i < shutdown_function_entry .arg_count ; i ++ ) {
1821
+ Z_TRY_ADDREF (shutdown_function_entry .arguments [i ]);
1837
1822
}
1823
+ zend_hash_next_index_insert_mem (BG (user_shutdown_function_names ), & shutdown_function_entry , sizeof (php_shutdown_function_entry ));
1838
1824
}
1839
1825
/* }}} */
1840
1826
@@ -2057,7 +2043,7 @@ PHP_FUNCTION(ini_get_all)
2057
2043
2058
2044
if (extname ) {
2059
2045
if ((module = zend_hash_str_find_ptr (& module_registry , extname , extname_len )) == NULL ) {
2060
- php_error_docref (NULL , E_WARNING , "Unable to find extension '%s' " , extname );
2046
+ php_error_docref (NULL , E_WARNING , "Extension \"%s\" cannot be found " , extname );
2061
2047
RETURN_FALSE ;
2062
2048
}
2063
2049
module_number = module -> module_number ;
@@ -2542,7 +2528,7 @@ PHP_FUNCTION(move_uploaded_file)
2542
2528
if (successful ) {
2543
2529
zend_hash_str_del (SG (rfc1867_uploaded_files ), path , path_len );
2544
2530
} else {
2545
- php_error_docref (NULL , E_WARNING , "Unable to move '%s' to '%s' " , path , new_path );
2531
+ php_error_docref (NULL , E_WARNING , "Unable to move \"%s\" to \"%s\" " , path , new_path );
2546
2532
}
2547
2533
2548
2534
RETURN_BOOL (successful );
0 commit comments