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
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PHP NEWS
. Fix OSS-Fuzz #429429090 (Failed assertion on unset() with uninitialized
container). (ilutov)
. Fixed GH-20564 (Don't call autoloaders with pending exception). (ilutov)
. Fix deprecation now showing when accessing null key of an array with JIT.
(alexandre-daubois)

- Date:
. Update timelib to 2022.16. (Derick)
Expand Down
3 changes: 1 addition & 2 deletions Zend/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ static inline zend_result zval_to_string_offset(zend_long *result, zval *op) {
static inline zend_result fetch_array_elem(zval **result, zval *op1, zval *op2) {
switch (Z_TYPE_P(op2)) {
case IS_NULL:
*result = zend_hash_find(Z_ARR_P(op1), ZSTR_EMPTY_ALLOC());
return SUCCESS;
return FAILURE;
case IS_FALSE:
*result = zend_hash_index_find(Z_ARR_P(op1), 0);
return SUCCESS;
Expand Down
2 changes: 0 additions & 2 deletions Zend/Optimizer/zend_call_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "zend_inference.h"
#include "zend_call_graph.h"
#include "zend_func_info.h"
#include "zend_inference.h"
#include "zend_call_graph.h"

static void zend_op_array_calc(zend_op_array *op_array, void *context)
{
Expand Down
1 change: 0 additions & 1 deletion Zend/Optimizer/zend_func_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "zend_inference.h"
#include "zend_call_graph.h"
#include "zend_func_info.h"
#include "zend_inference.h"
#ifdef _WIN32
#include "win32/ioutil.h"
#endif
Expand Down
6 changes: 0 additions & 6 deletions Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -1031,12 +1031,6 @@ void zend_assert_valid_class_name(const zend_string *const_name, const char *typ
zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope);
ZEND_API zend_string *zend_type_to_string(zend_type type);

/* BEGIN: OPCODES */

#include "zend_vm_opcodes.h"

/* END: OPCODES */

/* class fetches */
#define ZEND_FETCH_CLASS_DEFAULT 0
#define ZEND_FETCH_CLASS_SELF 1
Expand Down
5 changes: 2 additions & 3 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -2185,8 +2185,7 @@ static zend_property_info *zend_get_prop_not_accepting_double(zend_reference *re
return NULL;
}

static ZEND_COLD zend_long zend_throw_incdec_ref_error(
zend_reference *ref, zend_property_info *error_prop OPLINE_DC)
static ZEND_COLD zend_long zend_throw_incdec_ref_error(zend_property_info *error_prop OPLINE_DC)
{
zend_string *type_str = zend_type_to_string(error_prop->type);
if (ZEND_IS_INCREMENT(opline->opcode)) {
Expand Down Expand Up @@ -2247,7 +2246,7 @@ static void zend_incdec_typed_ref(zend_reference *ref, zval *copy OPLINE_DC EXEC
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(copy) == IS_LONG) {
zend_property_info *error_prop = zend_get_prop_not_accepting_double(ref);
if (UNEXPECTED(error_prop)) {
zend_long val = zend_throw_incdec_ref_error(ref, error_prop OPLINE_CC);
zend_long val = zend_throw_incdec_ref_error(error_prop OPLINE_CC);
ZVAL_LONG(var_ptr, val);
}
} else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, EX_USES_STRICT_TYPES()))) {
Expand Down
1 change: 1 addition & 0 deletions ext/dom/dom_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ zend_result dom_modern_node_prefix_read(dom_object *obj, zval *retval);
zend_result dom_node_prefix_write(dom_object *obj, zval *newval);
zend_result dom_node_local_name_read(dom_object *obj, zval *retval);
zend_result dom_node_base_uri_read(dom_object *obj, zval *retval);
zend_result dom_modern_node_base_uri_read(dom_object *obj, zval *retval);
zend_result dom_node_text_content_read(dom_object *obj, zval *retval);
zend_result dom_node_text_content_write(dom_object *obj, zval *newval);

Expand Down
25 changes: 18 additions & 7 deletions ext/dom/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,25 @@ zend_result dom_node_base_uri_read(dom_object *obj, zval *retval)
ZVAL_STRING(retval, (const char *) baseuri);
xmlFree(baseuri);
} else {
if (php_dom_follow_spec_intern(obj)) {
if (nodep->doc->URL) {
ZVAL_STRING(retval, (const char *) nodep->doc->URL);
} else {
ZVAL_STRING(retval, "about:blank");
}
ZVAL_NULL(retval);
}

return SUCCESS;
}

zend_result dom_modern_node_base_uri_read(dom_object *obj, zval *retval)
{
DOM_PROP_NODE(xmlNodePtr, nodep, obj);

xmlChar *baseuri = xmlNodeGetBase(nodep->doc, nodep);
if (baseuri) {
ZVAL_STRING(retval, (const char *) baseuri);
xmlFree(baseuri);
} else {
if (nodep->doc && nodep->doc->URL) {
ZVAL_STRING(retval, (const char *) nodep->doc->URL);
} else {
ZVAL_NULL(retval);
ZVAL_STRING(retval, "about:blank");
}
}

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/php_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&dom_modern_node_prop_handlers, 0, NULL, NULL, true);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "nodeType", dom_node_node_type_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "nodeName", dom_node_node_name_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "baseURI", dom_node_base_uri_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "baseURI", dom_modern_node_base_uri_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "isConnected", dom_node_is_connected_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "ownerDocument", dom_node_owner_document_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_node_prop_handlers, "parentNode", dom_node_parent_node_read, NULL);
Expand Down
28 changes: 28 additions & 0 deletions ext/dom/tests/modern/common/gh21077.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
GH-21077 (Accessing Dom\Node::baseURI can throw TypeError)
--EXTENSIONS--
dom
--CREDITS--
mbeccati
--FILE--
<?php

$implementation = new Dom\Implementation();
$node = $implementation->createDocumentType('html', 'publicId', 'systemId');

var_dump($node->baseURI);

$dom = Dom\XMLDocument::createEmpty();
$dom->append($node = $dom->importNode($node));

var_dump($dom->saveXML());

var_dump($node->baseURI);

?>
--EXPECT--
string(11) "about:blank"
string(84) "<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "publicId" "systemId">
"
string(11) "about:blank"
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object(Dom\DocumentType)#3 (19) {
["nodeName"]=>
string(5) "qname"
["baseURI"]=>
NULL
string(11) "about:blank"
["isConnected"]=>
bool(false)
["parentNode"]=>
Expand Down Expand Up @@ -86,7 +86,7 @@ object(Dom\DocumentType)#2 (19) {
["nodeName"]=>
string(5) "qname"
["baseURI"]=>
NULL
string(11) "about:blank"
["isConnected"]=>
bool(false)
["parentNode"]=>
Expand Down Expand Up @@ -129,7 +129,7 @@ object(Dom\DocumentType)#1 (19) {
["nodeName"]=>
string(5) "qname"
["baseURI"]=>
NULL
string(11) "about:blank"
["isConnected"]=>
bool(false)
["parentNode"]=>
Expand Down Expand Up @@ -172,7 +172,7 @@ object(Dom\DocumentType)#4 (19) {
["nodeName"]=>
string(5) "qname"
["baseURI"]=>
NULL
string(11) "about:blank"
["isConnected"]=>
bool(false)
["parentNode"]=>
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ object(Dom\Notation)#4 (13) {
["nodeName"]=>
string(3) "GIF"
["baseURI"]=>
NULL
string(11) "about:blank"
["isConnected"]=>
bool(false)
["parentNode"]=>
Expand Down
1 change: 0 additions & 1 deletion ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <libxml/uri.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlsave.h>
#include <libxml/xmlerror.h>
#include <libxml/entities.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
Expand Down
1 change: 0 additions & 1 deletion ext/mysqli/mysqli.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "zend_exceptions.h"
#include "ext/spl/spl_exceptions.h"
#include "zend_interfaces.h"
#include "zend_attributes.h"
#include "mysqli_arginfo.h"

ZEND_DECLARE_MODULE_GLOBALS(mysqli)
Expand Down
4 changes: 3 additions & 1 deletion ext/opcache/tests/jit/fetch_dim_r_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ function foo() {
}
foo();
?>
--EXPECT--
--EXPECTF--
int(1)
int(3)
int(2)
int(1)
int(3)
int(1)
int(2)

Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
int(4)
int(5)
int(5)
Expand Down
1 change: 0 additions & 1 deletion ext/phar/phar_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "main/SAPI.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"

static zend_class_entry *phar_ce_archive;
static zend_class_entry *phar_ce_data;
Expand Down
1 change: 0 additions & 1 deletion ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif

#include "zend_globals.h"
#include "php_globals.h"
#include "SAPI.h"
#include "php_ticks.h"

Expand Down
1 change: 0 additions & 1 deletion ext/standard/ftp_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "php_standard.h"
#include "ext/uri/php_uri.h"

#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion ext/standard/http_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

#include "php_standard.h"

#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion main/fopen_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <pwd.h>
#endif

#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
Expand Down
2 changes: 0 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#include "win32/php_registry.h"
#include "ext/standard/flock_compat.h"
#endif
#include "php_syslog.h"
#include "Zend/zend_exceptions.h"

#if PHP_SIGCHILD
Expand All @@ -75,7 +74,6 @@
#include "zend_compile.h"
#include "zend_execute.h"
#include "zend_highlight.h"
#include "zend_extensions.h"
#include "zend_ini.h"
#include "zend_dtrace.h"
#include "zend_observer.h"
Expand Down
1 change: 0 additions & 1 deletion sapi/apache2handler/apache_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
#include "http_core.h"

#ifdef PHP_AP_DEBUG
#define phpapdebug(a) fprintf a
Expand Down
1 change: 0 additions & 1 deletion sapi/apache2handler/php_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
#include "http_core.h"
#include "ap_mpm.h"
#ifndef PHP_WIN32
#include "unixd.h"
Expand Down
1 change: 0 additions & 1 deletion sapi/apache2handler/sapi_apache2.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
#include "http_core.h"
#include "ap_mpm.h"

#include "php_apache.h"
Expand Down
1 change: 0 additions & 1 deletion sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
#include "php_globals.h"
#include "php_main.h"
#include "fopen_wrappers.h"
#include "http_status_codes.h"
Expand Down
2 changes: 0 additions & 2 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "SAPI.h"

#include <stdio.h>
#include "php.h"
#ifdef PHP_WIN32
#include "win32/time.h"
#include "win32/signal.h"
Expand All @@ -51,7 +50,6 @@
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
#include "php_globals.h"
#include "php_main.h"
#include "fopen_wrappers.h"
#include "ext/standard/php_standard.h"
Expand Down
1 change: 0 additions & 1 deletion sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <unistd.h>
#endif

#include <signal.h>
#include <locale.h>

#ifdef HAVE_DLFCN_H
Expand Down
1 change: 0 additions & 1 deletion sapi/fpm/fpm/fpm_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <inttypes.h>

#include <stdio.h>
Expand Down
3 changes: 0 additions & 3 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
#include "php_variables.h"
#include "php_ini_builder.h"
#include "zend_modules.h"
#include "php.h"
#include "zend_ini_scanner.h"
#include "zend_globals.h"
#include "zend_stream.h"

#include "SAPI.h"

#include <stdio.h>
#include "php.h"

#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
Expand Down Expand Up @@ -61,7 +59,6 @@
#include "zend.h"
#include "zend_extensions.h"
#include "php_ini.h"
#include "php_globals.h"
#include "php_main.h"
#include "fopen_wrappers.h"
#include "ext/standard/php_standard.h"
Expand Down
1 change: 0 additions & 1 deletion sapi/litespeed/lscriu.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/mman.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
Expand Down
1 change: 0 additions & 1 deletion sapi/phpdbg/phpdbg_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ typedef void* yyscan_t;

#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
#include "phpdbg_cmd.h"
#include "phpdbg_prompt.h"

#include "phpdbg_parser.h"
Expand Down