Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Zend/tests/functions/zend_call_function_deprecated_frame.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Deprecated function notice promoted to exception within zend_call_function()
--FILE--
<?php

#[Deprecated]
function foo(string $v) {
return $v . '!';
}

set_error_handler(function ($number, $message) {
throw new Exception($message);
});

$a = array_map(foo(...), ['Hello', 'World']);
var_dump($a);

?>
--EXPECTF--
Fatal error: Uncaught Exception: Function foo() is deprecated in %s:%d
Stack trace:
#0 [internal function]: {closure:%s:%d}(16384, 'Function foo() ...', '%s', %d)
#1 %s(%d): array_map(Object(Closure), Array)
#2 {main}
thrown in %s on line %d
7 changes: 3 additions & 4 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,18 +862,17 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_HAS_THIS;
}

call = zend_vm_stack_push_call_frame(call_info,
func, fci->param_count, object_or_called_scope);

if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_DEPRECATED)) {
zend_deprecated_function(func);

if (UNEXPECTED(EG(exception))) {
zend_vm_stack_free_call_frame(call);
return SUCCESS;
}
}

call = zend_vm_stack_push_call_frame(call_info,
func, fci->param_count, object_or_called_scope);

for (uint32_t i = 0; i < fci->param_count; i++) {
zval *param = ZEND_CALL_ARG(call, i+1);
zval *arg = &fci->params[i];
Expand Down
5 changes: 2 additions & 3 deletions ext/openssl/xp_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,6 @@ static int php_openssl_sockop_stat(php_stream *stream, php_stream_statbuf *ssb)
static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_netstream_data_t *sock,
php_stream_xport_param *xparam STREAMS_DC) /* {{{ */
{
int clisock;
bool nodelay = false;
zval *tmpzval = NULL;

Expand All @@ -2231,7 +2230,7 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
nodelay = true;
}

clisock = php_network_accept_incoming(sock->s.socket,
php_socket_t clisock = php_network_accept_incoming(sock->s.socket,
xparam->want_textaddr ? &xparam->outputs.textaddr : NULL,
xparam->want_addr ? &xparam->outputs.addr : NULL,
xparam->want_addr ? &xparam->outputs.addrlen : NULL,
Expand All @@ -2240,7 +2239,7 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
&xparam->outputs.error_code,
nodelay);

if (clisock >= 0) {
if (clisock != SOCK_ERR) {
php_openssl_netstream_data_t *clisockdata = (php_openssl_netstream_data_t*) emalloc(sizeof(*clisockdata));

/* copy underlying tcp fields */
Expand Down
7 changes: 4 additions & 3 deletions ext/pdo_mysql/mysql_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ static int pdo_mysql_stmt_get_col(

static char *type_to_name_native(int type) /* {{{ */
{
#define PDO_MYSQL_NATIVE_TYPE_NAME(x) case FIELD_TYPE_##x: return #x;
#define PDO_MYSQL_NATIVE_TYPE_NAME(x) case MYSQL_TYPE_##x: return #x;

switch (type) {
PDO_MYSQL_NATIVE_TYPE_NAME(STRING)
Expand Down Expand Up @@ -747,10 +747,11 @@ static char *type_to_name_native(int type) /* {{{ */
#ifdef FIELD_TYPE_NEWDATE
PDO_MYSQL_NATIVE_TYPE_NAME(NEWDATE)
#endif
#ifdef FIELD_TYPE_VECTOR
/* The following 2 don't have BC FIELD_TYPE_* aliases. */
#if MYSQL_VERSION_ID >= 90000 && !defined(MARIADB_BASE_VERSION) /* TODO: mysqlnd support (added in 8.4 via a1ab846231aeff49c0441a30ebd44463fc7825b1) */
PDO_MYSQL_NATIVE_TYPE_NAME(VECTOR)
#endif
#ifdef FIELD_TYPE_JSON
#if MYSQL_VERSION_ID >= 50708 || defined(PDO_USE_MYSQLND)
PDO_MYSQL_NATIVE_TYPE_NAME(JSON)
#endif
PDO_MYSQL_NATIVE_TYPE_NAME(TIME)
Expand Down
2 changes: 1 addition & 1 deletion main/streams/xp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t
&xparam->outputs.error_code,
nodelay);

if (clisock >= 0) {
if (clisock != SOCK_ERR) {
php_netstream_data_t *clisockdata = (php_netstream_data_t*) emalloc(sizeof(*clisockdata));

memcpy(clisockdata, sock, sizeof(*clisockdata));
Expand Down