Skip to content

Instantly share code, notes, and snippets.

View m6w6's full-sized avatar

Michael Wallner m6w6

View GitHub Profile
@m6w6
m6w6 / gdb.txt
Last active February 3, 2016 19:35
psi glob
(gdb) r
Starting program: /home/mike/build/php-master-dbg/sapi/cli/php -d psi.directory=psi.d:/home/mike/src/psi/tests/glob /home/mike/src/psi/tests/glob/glob002.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Hardware watchpoint 4: *(char **)0xd70298
Old value = <unreadable>
New value = 0xd702f0 ""
0x00007ffff641bfa5 in __fopen_internal () from /usr/lib/libc.so.6
(gdb) c
@m6w6
m6w6 / abort.txt
Created January 19, 2016 19:02
master-constant-internal-interfaces-crash
*** Error in `/home/mike/build/php-master-dbg-zts/sapi/cli/php': corrupted double-linked list: 0x0000000002e69f10 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72055)[0x7fb14b8c3055]
/usr/lib/libc.so.6(+0x779a6)[0x7fb14b8c89a6]
/usr/lib/libc.so.6(+0x77c39)[0x7fb14b8c8c39]
/usr/lib/libc.so.6(+0x78810)[0x7fb14b8c9810]
/home/mike/build/php-master-dbg-zts/sapi/cli/php(zend_hash_destroy+0x282)[0x936084]
/home/mike/build/php-master-dbg-zts/sapi/cli/php[0x91c71a]
/home/mike/build/php-master-dbg-zts/sapi/cli/php(tsrm_shutdown+0xf4)[0x85a40c]
/home/mike/build/php-master-dbg-zts/sapi/cli/php[0x9f0443]
Verifying that +michaelwallner is my blockchain ID. https://onename.com/michaelwallner
@m6w6
m6w6 / gist:133de3760fa80109c9bf
Created August 19, 2015 16:22
gcc -fsanitize=alignment
Running selected tests.
/home/mike/src/php-master/ext/pcre/pcrelib/sljit/sljitNativeX86_64.c:519:26: runtime error: store to misaligned address 0x000002e4b111 for type 'sljit_si', which requires 4 byte alignment
0x000002e4b111: note: pointer points here
07 48 00 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/mike/src/php-master/ext/pcre/pcrelib/sljit/sljitNativeX86_64.c:342:19: runtime error: store to misaligned address 0x000002e4b186 for type 'sljit_si', which requires 4 byte alignment
0x000002e4b186: note: pointer points here
fe 06 48 3d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
/home/mike/src/php-master/ext/pcre/pcrelib/sljit/sljitNativeX86_64.c:546:24: runtime error: store to misaligned address 0x000002e4b29d for type 'sljit_si', which requires 4 byte alignment
@m6w6
m6w6 / zend_inheritance.diff
Created August 17, 2015 15:58
Fix inheritance of internal interafce's constants
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 77ea7d5..3ccade9 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -917,7 +917,13 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva
static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
{
if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
- ZVAL_MAKE_REF(zv);
+ if (!Z_ISREF_P(zv)) {
@m6w6
m6w6 / gc.txt
Last active August 29, 2015 14:22
gc array/object order
█ mike@smugmug:~/build/php-master-dbg-zts$ sapi/cli/php -r '$m[]=new http\Message; $m[]=new http\Message; $m[0]->prepend($m[1]);'
[0x7ff805a58180] rc=1 addr=0 black array(1) ->purple
[0x7ff805a82128] rc=1 addr=0 black object(http\Message)#1 ->purple
[0x7ff805a82228] rc=1 addr=0 black object(http\Message)#2 ->purple
[0x7ff805a58060] rc=1 addr=0 black array(0) ->purple
[0x7ff805a58000] rc=1 addr=0 black array(0) ->purple
[0x7ff805a580c0] rc=1 addr=0 black array(0) ->purple
[0x7ff805a581e0] rc=1 addr=0 black array(86) ->purple
[0x7ff805a58120] rc=1 addr=0 black array(0) ->purple
[0x7ff805a82128] rc=0 addr=2 purple object(http\Message)#1 ->purple
@m6w6
m6w6 / go-php7-ext.css
Created March 12, 2015 17:13
Expand the wiki page to view the whole table
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url("https://github.com/gophp7/gophp7-ext/wiki/extensions-catalog") {
div.container {
width: 90%;
}
.repository-with-sidebar .repository-content {
width: 80% !important;
}
}
@m6w6
m6w6 / iter.php
Created March 11, 2015 15:01
cake/Collection bug with generators and iterators
<?php
$gen = function() {
yield 1;
};
$iter = new IteratorIterator($gen());
$ngen = $iter->getInnerIterator();
class ReplaceIterator extends IteratorIterator
@m6w6
m6w6 / query_rfc_pecl_http.php
Created February 20, 2015 21:47
Query pecl_http RFC votes
<?php
(new http\Client)->enqueue(
new http\Client\Request("GET", "https://wiki.php.net/rfc/pecl_http"),
function($res) {
$xpath = new DomXpath(@DomDocument::loadHtml($res->getBody()));
$nodes = $xpath->query("//form[@id='doodle__form__add_pecl_http_to_the_core']/table/tbody/tr[last()]/th");
printf("Choice: | %14s | %14s | %14s |\n", "Yes, enabled", "Yes, disabled", "No, no way!");
vprintf("%s | %14d | %14d | %14d |\n", array_map(function($node) {
return $node->textContent;
diff --git a/run-tests.php b/run-tests.php
index 15b7fe2..d225ce4 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -136,6 +136,13 @@ if ((substr(PHP_OS, 0, 3) == "WIN") && empty($environment["SystemRoot"])) {
$environment["SystemRoot"] = getenv("SystemRoot");
}
+if (is_readable("/proc/cpuinfo")) {
+ $concurrency = min(64, max(1, preg_match_all("/^processor/mi", file_get_contents("/proc/cpuinfo"))));