Skip to content

Instantly share code, notes, and snippets.

> It's just terrible to use the opcodes could be hidden, maybe toggle with a verbosity level flag e.g -v2.
They are hidden by default, you are shown opcodes when it's appropriate to show you opcodes or on request, if there's a bug, please report it.
> It's not smooth like pdb in python - having to 'eval' everything doesnt feel right.
You appear to be complaining that this isn't like some other software you have used, I'm not sure what to do with that.
Having to eval everything makes sense from the perspective that not all input is code, this is not a REPL, this is a debugger. What for example do we do with the input "run" if there is a run constant defined !? The answer is; nothing that makes sense in all situations. What does make sense, is eval'ing code.
@krakjoe
krakjoe / datetimeabstract.patch
Created July 21, 2015 12:01
DateTimeAbstract
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 2f52353..930c9f1 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -326,7 +326,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
- ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeAbstract, 0)
@krakjoe
krakjoe / mandel.md
Last active October 8, 2015 08:53
mandel pthreads

This is a rather extreme test ... still, was fun ...

[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 0 128

real	0m11.441s
user	0m11.386s
sys	0m0.043s
[joe@fiji pthreads]$ time php-zts ../php-src/mandrel.php 1 128
@krakjoe
krakjoe / gist:4271903
Created December 12, 2012 21:43
jemalloc.patch
diff -ur a/php-src-jemalloc-zendmm/Zend/zend_alloc.c b/php-src-jemalloc-zendmm/Zend/zend_alloc.c
--- a/php-src-jemalloc-zendmm/Zend/zend_alloc.c 2012-12-12 06:59:10.000000000 +0100
+++ b/php-src-jemalloc-zendmm/Zend/zend_alloc.c 2012-12-12 22:35:24.000000000 +0100
@@ -38,17 +38,20 @@
#endif
#ifdef HAVE_MEM_JEMALLOC
-# ifndef JEMALLOC_NO_DEMANGLE
-# define JEMALLOC_NO_DEMANGLE
+# ifdef JEMALLOC_PREFIX
@krakjoe
krakjoe / gist:4273826
Created December 13, 2012 03:38
custom-allocators apply on top of patch from earlier today, tested with jemalloc, tcmalloc, GC_, should be flexible enough to give them all a good testing ...
diff -ur a/php-src-jemalloc-zendmm/Zend/zend_alloc.c b/php-src-jemalloc-zendmm/Zend/zend_alloc.c
--- a/php-src-jemalloc-zendmm/Zend/zend_alloc.c 2012-12-12 06:59:10.000000000 +0100
+++ b/php-src-jemalloc-zendmm/Zend/zend_alloc.c 2012-12-13 03:00:41.000000000 +0100
@@ -37,18 +37,19 @@
# include <process.h>
#endif
-#ifdef HAVE_MEM_JEMALLOC
-# ifndef JEMALLOC_NO_DEMANGLE
-# define JEMALLOC_NO_DEMANGLE
@krakjoe
krakjoe / v.php
Created February 27, 2013 18:37
editable configuration originating from APC by example...
<?php
/*
An example of read/writable multi-threaded configuration
*/
class Config extends Stackable {
public function __construct($config) {
$this->map($config);
}
/* this makes everything safe */
@krakjoe
krakjoe / bench.php
Created March 22, 2013 10:53
Zend/bench.php for pthreads ...
<?php
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("UTC");
}
class GStore extends Stackable {
public function run(){}
public $value;
@krakjoe
krakjoe / igbinary.patch
Created March 26, 2013 08:13
igbinary apcu patch
diff -uNr igbinary-1.1.1/apc_serializer.h igbinary-1.1.1-apcu-patched/apc_serializer.h
--- igbinary-1.1.1/apc_serializer.h 2011-03-14 12:32:48.000000000 +0000
+++ igbinary-1.1.1-apcu-patched/apc_serializer.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | APC |
- +----------------------------------------------------------------------+
- | Copyright (c) 2006-2011 The PHP Group |
- +----------------------------------------------------------------------+
@krakjoe
krakjoe / get_object_stats
Last active December 15, 2015 14:39
get_objects_count function for RFC
--- php-virgin/Zend/zend_builtin_functions.c 2013-04-04 16:44:42.930473062 +0100
+++ php-nts/Zend/zend_builtin_functions.c 2013-04-10 08:39:54.716250434 +0100
@@ -64,6 +64,7 @@
static ZEND_FUNCTION(is_subclass_of);
static ZEND_FUNCTION(is_a);
static ZEND_FUNCTION(get_class_vars);
+static ZEND_FUNCTION(get_objects_count);
static ZEND_FUNCTION(get_object_vars);
static ZEND_FUNCTION(get_class_methods);
static ZEND_FUNCTION(trigger_error);
@krakjoe
krakjoe / php_api.h
Last active December 15, 2015 18:38
a (completely untested) unified php api, perhaps, just the "gist" ... its correct "enough" ...
/* +----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |