Skip to content

Instantly share code, notes, and snippets.

View nielsdos's full-sized avatar

Niels Dossche nielsdos

  • Belgium
View GitHub Profile
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
RuntimeError: index out of bounds
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[1233]:0x81adc
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[26361]:0xb54160
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[1232]:0x81994
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[6098]:0x310066
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[24249]:0xaacc32
@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.wasm:wasm-function[22218]:0xa4d779
invoke_i@https://niels-mats.be/runner-146dd302fec86b1ab7f488daceee952b55425ac0/Build/build.framework.js:2:383576
@https://niels-mats.be/runner-146dd302fec86b1ab7f4
cat goodreads.tsv | tail -n+2 | cut -f2 | egrep '\(.+,? #[0-9a-zA-Z -]+\)' | sed -E 's|^.*\(([^#]+,?) #[0-9a-zA-Z #,;-]+\).*$|\1|p' | sed 's/,$//' | sort | uniq -c | sed -E 's/^ +[0-9]+ //' | sort
<?php
// Test script based on lunter2's: https://github.com/php/php-src/issues/10993#issuecomment-1493166391
ini_set('memory_limit',"2G");
function get_tmp_array() {
return range(0, 1000);
}
<?php
$start = microtime(true);
$input = range(0, 1000);
for ($i = 0; $i < 1000; $i++) {
$a = array_unique($input, SORT_REGULAR);
}
$delta = microtime(true) - $start;
@nielsdos
nielsdos / sort_double.php
Created April 11, 2023 20:43
sort_double.php
<?php
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
$r = range(0, 1000, 0.5);
sort($r, SORT_REGULAR);
}
$delta = microtime(true) - $start;
@nielsdos
nielsdos / gh11591_test.php
Created July 5, 2023 20:06
gh11591_test.php
<?php
function yieldEmpty() {
yield from [];
}
function yieldNotEmpty($min, $max) {
yield from range($min, $max);
}
@nielsdos
nielsdos / html5.md
Last active November 27, 2023 11:06
Dockerfile for HTML5 branch

Building the following Dockerfile will give you the latest version of my ext/dom HTML5 branch:

FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update
RUN apt install -y binutils gcc re2c flex bison libxml2-dev libsqlite3-dev vim git autoconf pkg-config make libonig-dev
<?php
$test = match(true) {
true => {
<-;
},
};
@nielsdos
nielsdos / execute_bench.php
Created August 29, 2023 18:04
HTML5 benchmarking
<?php
include "sites.php";
if (count($_SERVER["argv"]) != 3) {
echo "Usage: php execute_bench.php <id> <class>\n";
exit(1);
}
$id = (int) $_SERVER["argv"][1];
$class = $_SERVER["argv"][2];
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 052be0c5cc..9b1f0e6013 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1230,8 +1230,11 @@ static int sxe_objects_compare(zval *object1, zval *object2) /* {{{ */
sxe2 = Z_SXEOBJ_P(object2);
if (sxe1->node != NULL && sxe2->node != NULL) {
+ xmlNodePtr node1 = php_sxe_get_first_node(sxe1, sxe1->node->node);
+ xmlNodePtr node2 = php_sxe_get_first_node(sxe2, sxe2->node->node);