Skip to content

Instantly share code, notes, and snippets.

@krakjoe
krakjoe / generics-parser.patch
Last active January 3, 2016 11:39
generics-parser.patch
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 752e27f..989296d 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -45,7 +45,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%}
%pure_parser
-%expect 3
+%expect 5
@krakjoe
krakjoe / arrayof-typehints.patch
Last active January 3, 2016 02:58
arrayof-typehints.patch
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 3f43b09..6f2ff75 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1845,7 +1845,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
}
/* }}} */
-void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initialization, znode *class_type, zend_uchar pass_by_reference, zend_bool is_variadic TSRMLS_DC) /* {{{ */
+void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initialization, znode *class_type, zend_uchar pass_by_reference, zend_bool is_variadic, zend_bool is_arrayof TSRMLS_DC) /* {{{ */
@krakjoe
krakjoe / nl2br.patch
Created October 30, 2013 16:02
nl2br limit
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 2f05b65..5e1db9d 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4210,19 +4210,20 @@ PHP_FUNCTION(hebrevc)
}
/* }}} */
-/* {{{ proto string nl2br(string str [, bool is_xhtml])
+/* {{{ proto string nl2br(string str [, bool is_xhtml [, integer limit]])
@krakjoe
krakjoe / get_network_interfaces_unix_all.patch
Last active December 26, 2015 16:39
get_network_interfaces
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index 945409e..ed4c0d7 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -106,6 +106,25 @@ ZEND_FP_EXCEPT
ZEND_CHECK_FLOAT_PRECISION
+AC_MSG_CHECKING([for usable ifaddrs.h])
+ AC_TRY_LINK([
@krakjoe
krakjoe / anon.php
Last active December 23, 2015 23:09
anon classes demo
<pre>
<?php
class Outer {
protected $data;
public function __construct(&$data) {
/* array access will be implemented by the time we get to here */
$this->data = &$data;
}
@krakjoe
krakjoe / gist:6577810
Last active December 23, 2015 04:08
Testing something ...
<?php
/* creating 50 threads is nearly always a bad idea */
class WebRequest extends Thread {
public $url;
public $data;
public $runtime;
public function __construct($url) {
$this->url = $url;
}
@krakjoe
krakjoe / monte.php
Last active December 17, 2015 18:29
An example of why threading is better ...
<?php
/*
* This class wraps a number that should be changed exclusively by each context
*/
class AtomicNumber extends Stackable {
public $value;
public function __construct($value) { $this->value = $value; }
public function run(){}
@krakjoe
krakjoe / leak.php
Last active December 17, 2015 07:59
<?php
class Job extends \Stackable {
function run() {
$this->isComplete = TRUE;
}
}
class MyWorker extends \Worker {
function run() {}
}
@krakjoe
krakjoe / stacking_error_handlers.patch
Created April 23, 2013 08:13
stacking error handlers
--- php-src/Zend/zend.h 2013-04-15 17:22:35.094419723 +0100
+++ php-fork/Zend/zend.h 2013-04-22 15:29:38.679615669 +0100
@@ -296,6 +296,34 @@
# define zend_error_noreturn zend_error
#endif
+/* {{{ zend_error_t */
+typedef struct zend_error_t {
+ zend_bool handled;
+ zend_ushort level;
@krakjoe
krakjoe / zend_register_bool_constant.patch
Created April 15, 2013 16:26
zend_register_bool_constant, just for completeness ...
--- php-src/Zend/zend_constants.h 2013-02-16 19:17:32.870980302 +0000
+++ php-fork/Zend/zend_constants.h 2013-04-15 17:11:39.049385269 +0100
@@ -38,16 +38,19 @@
int module_number;
} zend_constant;
+#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name), (bval), (flags), module_number TSRMLS_CC)
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
#define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
#define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)