Skip to content

Instantly share code, notes, and snippets.

View dstogov's full-sized avatar

Dmitry Stogov dstogov

  • Zend by Perforce
  • Russia
View GitHub Profile
diff --git a/Zend/zend.h b/Zend/zend.h
index 1021829..bfdbf5b 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -303,8 +303,10 @@ typedef enum {
!(EG(current_execute_data)->prev_execute_data->opline->result_type & EXT_TYPE_UNUSED))
#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
+# define ZEND_NORETURN __attribute__((noreturn))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 1e29ea4..9b1f0d2 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -78,6 +78,7 @@ static ZEND_FUNCTION(get_defined_functions);
static ZEND_FUNCTION(get_defined_vars);
static ZEND_FUNCTION(create_function);
static ZEND_FUNCTION(get_resource_type);
+static ZEND_FUNCTION(get_resources);
static ZEND_FUNCTION(get_loaded_extensions);
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index a8ee529..0b42f95 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3604,9 +3604,13 @@ static void zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type
static void zend_separate_if_call_and_write(znode *node, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */
{
if (type != BP_VAR_R && type != BP_VAR_IS && zend_is_call(ast)) {
- zend_op *opline = zend_emit_op(NULL, ZEND_SEPARATE, node, NULL TSRMLS_CC);
- opline->result_type = IS_VAR;
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 586edde..9f6016b 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -755,42 +755,8 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
FREE_OP_IF_VAR(free_value);
}
-static zend_always_inline zend_long zend_fetch_dimension_str_offset(zval *dim, int type TSRMLS_DC)
+static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, int value_type, zval *result TSRMLS_DC)
$ cat xx.php
<?php
$a = array(1=>2);
foreach ($a as $key => $val) {
$a[$key+1] = $val + 1;
}
var_dump($a);
$ sapi/cli/php xx.php
array(2) {
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index dd1c2d6..32d2e5f 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -119,6 +119,9 @@
# define ZEND_MM_CUSTOM 1 /* support for custom memory allocator */
/* USE_ZEND_ALLOC=0 may switch to system malloc() */
#endif
+#ifndef ZEND_MM_STORAGE
+# define ZEND_MM_STORAGE 1 /* support for custom memory storage */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5d3ee24..a8bfdb1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2281,8 +2281,6 @@ void zend_compile_assign(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
opline->opcode = ZEND_ASSIGN_DIM;
opline = zend_emit_op_data(&expr_node TSRMLS_CC);
- opline->op2.var = get_temporary_variable(CG(active_op_array));
- opline->op2_type = IS_VAR;
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index b91ac5b..08205c2 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -46,6 +46,49 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML
while (opline < end) {
switch (opline->opcode) {
+#if 1
+ case ZEND_DECLARE_INHERITED_CLASS:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b5d446a..45ac067 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -874,13 +874,12 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC)
{
- if (ZCG(accel_directives).revalidate_freq &&
- (persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
diff --git a/Zend/tests/return_types/001.phpt b/Zend/tests/return_types/001.phpt
new file mode 100644
index 0000000..a751bd3
--- /dev/null
+++ b/Zend/tests/return_types/001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Returned nothing, expected array
+
+--FILE--