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_types.h b/Zend/zend_types.h
index 82a168f..74024c7 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -22,6 +22,10 @@
#ifndef ZEND_TYPES_H
#define ZEND_TYPES_H
+#ifndef ZEND_WIN32
+# include <inttypes.h>
diff --git a/Zend/zend.h b/Zend/zend.h
index c346c02..a90165c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -179,6 +179,14 @@ char *alloca ();
# define ZEND_ATTRIBUTE_DEPRECATED
#endif
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
+# define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
diff --git a/Zend/zend.h b/Zend/zend.h
index c346c02..a90165c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -179,6 +179,14 @@ char *alloca ();
# define ZEND_ATTRIBUTE_DEPRECATED
#endif
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
+# define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
diff --git a/Zend/zend.c b/Zend/zend.c
index 297fe26..b995966 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -385,13 +385,15 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS_EX("Array\n");
- if (++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
+ if (!Z_IMMUTABLE_P(expr) && ++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index c196134..0952dbe 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -285,11 +285,27 @@ static inline int _zend_handle_numeric_str(const char *key, int length, ulong *i
}
}
+static inline int _zend_handle_numeric(zend_string *key, ulong *idx)
+{
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 02a313b..f305fe8 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -524,20 +524,22 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
/* it leaked: Lets deliberately NOT pefree it so that the memory manager shows it
* as leaked; it will log a warning, but lets help it out and display what kind
* of stream it was. */
- char *leakinfo;
- spprintf(&leakinfo, 0, __FILE__ "(%d) : Stream of type '%s' %p (path:%s) was not closed\n", __LINE__, stream->ops->label, stream, stream->orig_path);
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index ad92c5f..6ada04e 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -943,6 +943,26 @@ copy_value:
}
}
+static void zval_deep_copy(zval **p)
+{
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;