Skip to content

Instantly share code, notes, and snippets.

@laruence
laruence / fr61682.patch
Created April 12, 2012 14:57
Allow use As in closure declaration
index 6f2ded3..67eeefd 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -291,6 +291,66 @@ static zend_object_value zend_closure_clone(zval *zobject TSRMLS_DC) /* {{{ */
}
/* }}} */
+static int zend_closure_copy_lexical_var(zval **p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
+{
+ zval *tmp;
@laruence
laruence / constdereference.patch
Created April 13, 2012 08:03
Const array/string dereference
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index d0730b7..893e013 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -789,8 +789,8 @@ expr_without_variable:
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
| scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '[' array_pair_list ']' { $$ = $2; }
@laruence
laruence / gist:2559963
Created April 30, 2012 16:50
C++ constructor
#include <cstdlib>
#include <cstdio>
class Base {
public:
Base() {
printf("base constructor called\n");
}
};
@laruence
laruence / bug.patch
Created July 16, 2012 05:42
web-qa doesn't show the whole pull requests
diff --git a/pulls/index.php b/pulls/index.php
index 314c936..4fff407 100644
--- a/pulls/index.php
+++ b/pulls/index.php
@@ -57,8 +57,18 @@ common_header();
white-space: pre;
}
+ #backToRepolist {
+ float: left;
@laruence
laruence / gist:5129104
Created March 10, 2013 15:52
apc.enable_opcode_cache
Index: apc_main.c
===================================================================
--- apc_main.c (revision 329723)
+++ apc_main.c (working copy)
@@ -907,8 +907,11 @@
apc_user_cache = apc_cache_create(APCG(user_entries_hint), APCG(gc_ttl), APCG(user_ttl) TSRMLS_CC);
/* override compilation */
- old_compile_file = zend_compile_file;
- zend_compile_file = my_compile_file;
@laruence
laruence / gist:5260811
Created March 28, 2013 05:05
php interactive test
$ cat sapi/cli/tests/bug64529.phpt
--TEST--
Bug #64529 (Ran out of opcode space)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test");
if (!file_exists("/usr/bin/expect")) die "skip no expect installed";
?>
--FILE--
<?php
<?php
interface Foo {
public function foo();
public function foo1($a);
public function foo2($b, $c = NULL);
public function foo3($e, $c = NULL);
public function foo4(array $f);
}
class Bar {
==70229== ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff557649f7 at pc 0x10ac4203d bp 0x7fff557648f0 sp 0x7fff557648e8
READ of size 1 at 0x7fff557649f7 thread T0
#0 0x10ac4203c (/Users/Laruence/opensource/php-5.5/sapi/cli/php+0x1007a903c)
Address 0x7fff557649f7 is located at offset 55 in frame <date_object_get_properties> of T0's stack:
This frame has 1 object(s):
[32, 40) 'zv'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
Shadow bytes around the buggy address:
0x1fffeaaec8e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 72b5a1b..48ff730 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -37,6 +37,7 @@
#include "zend_API.h"
#include "zend_ini.h"
#include "TSRM/tsrm_virtual_cwd.h"
+#include "ext/phar/php_phar.h"
#include "zend_accelerator_util_funcs.h"
diff --git a/ZendAccelerator.c b/ZendAccelerator.c
index 72b5a1b..002a71a 100644
--- a/ZendAccelerator.c
+++ b/ZendAccelerator.c
@@ -37,6 +37,9 @@
#include "zend_API.h"
#include "zend_ini.h"
#include "TSRM/tsrm_virtual_cwd.h"
+#ifdef HAVE_PHAR_HEADER
+#include "ext/phar/php_phar.h"