k47's Avatar

k47

@k47q.bsky.social

Eat the rich

3 Followers  |  1 Following  |  20 Posts  |  Joined: 11.03.2025  |  1.5379

Latest posts by k47q.bsky.social on Bluesky

každý den se nějaký čůrák za volantem najde.
margaras.k47.cz/@k47/statuse...

15.10.2025 16:34 — 👍 0    🔁 0    💬 0    📌 0

fun fact: PHP manages memory using reference counting, but xml extensions for some reason implement their own reference counting on top of general reference counting.
github.com/php/php-src/...
#PHP

14.10.2025 08:54 — 👍 0    🔁 0    💬 0    📌 0

if you just happen to write a very basic jit compiler (for PHP, lets say) that generates simple binary that's calling into opcode handlers, you are limited by throughput of call/ret instructions, which is not that good.
margaras.k47.cz/@k47/statuse...
#PHP

02.10.2025 22:57 — 👍 0    🔁 0    💬 0    📌 0

if you want to write PHP from scratch, the first you have decide how you are going to manage memory
margaras.k47.cz/@k47/statuse...
#PHP

29.09.2025 17:40 — 👍 1    🔁 0    💬 0    📌 0

to fight against despair i need a project

so what if i reimplemented php from scratch?

margaras.k47.cz/@k47/statuse...

#PHP

27.09.2025 12:44 — 👍 0    🔁 0    💬 0    📌 0

fun little php detail margaras.k47.cz/@k47/statuse... #PHP

30.08.2025 09:56 — 👍 0    🔁 1    💬 0    📌 0

Podívejte, co plave na zdejších rybnících: Kachnička mandarinská. k47.cz/2025/kachnic...

08.08.2025 12:43 — 👍 0    🔁 0    💬 0    📌 0

I wouldn't. On purpose. But bugs are evil things waiting to attack us when we are most vulnerable.

Imagine this

foreach ($items as &$i){}
for ($i=0;$i<100;$i++){}

We iterate an array to modify it in place, then use $i as index in unrelated loop and whoops, the the last element is suddenly changed

04.07.2025 13:46 — 👍 0    🔁 0    💬 0    📌 0

php references are hilarious. not even this simple loop is not guaranteed to terminate

for ($i = 0; $i < 100; $i++) {
$a = 0;
}

not if $a and $i are references to each other

$a = 0;
$i = &$a;

#PHP

03.07.2025 17:12 — 👍 1    🔁 0    💬 1    📌 0

and there it is: GCC supports preserve_none attribute on x86

gcc.gnu.org/git/?p=gcc.g...

it's a feature precisely targeting tailcalling interpreters...

margaras.k47.cz/@k47/statuse...

28.06.2025 15:07 — 👍 0    🔁 0    💬 0    📌 0

this is pretty interesting:

imagine you have an array of sorted integers

if you rotate each integer one bit to the right, you need single pass of 1-bit radix sort to make the sequence sorted again...

margaras.k47.cz/@k47/statuse...

24.06.2025 15:26 — 👍 0    🔁 0    💬 0    📌 0

"I'm married to my job."

"So, what do you do?"

"Unemployed."

28.05.2025 10:24 — 👍 0    🔁 0    💬 0    📌 0

PHP references are poison.

for example: what can we say about the type of variable $i?

for ($i = 0; $i < 1000; $i++) { f($i); }

one would expect that it can only be an integer, but no. function f can be something like this

function f(int &$arg) { $arg = "lol"; }

and then all bets are off.

#PHP

23.05.2025 10:02 — 👍 0    🔁 0    💬 0    📌 0
Preview
Laptop není mrtvý, ale umírá Všechno jednou rozpadne. Ani můj laptop není výjimkou. Repasovaný thinkpad x270, který jsem za 3990 korun koupil v červenci 2023, začal minulý prosinec umírat. Nahodile zamrzal. Obrazovka zčernala,…

jsem bez peněz a teď mi ještě umírá laptop k47.cz/2025/pining-...

30.04.2025 12:06 — 👍 0    🔁 0    💬 1    📌 0

error messages looks like this

ir_base[21].ops[1] insn reference (32825) is out of range
ir_base[21].ops[1] reference (32825) must be DATA
ir_base[21].ops[1] (32825) type is incompatible with...

reasonable if you just happen to be Dmitry Stogov, not if you are peasant like the rest of us

#PHP

13.04.2025 12:29 — 👍 0    🔁 0    💬 0    📌 0

poking around in php jit is delightful. two key data types are declared like this:

typedef int32_t ir_ref;
typedef uintptr_t zend_jit_addr;

typesafety? never heard about it.

#PHP

13.04.2025 12:27 — 👍 0    🔁 0    💬 0    📌 0

there's a little memory exhaustion attack againt #php for you: send this 21 byte json "[[[[[[[[[[1]]]]]]]]]]" and json_decode allocates 2160 bytes of memory. that's 100x amplification. 10MB malicious json that forces php to allocate 1GB of memory can be gzipped to 25 kB.

05.04.2025 09:28 — 👍 2    🔁 1    💬 0    📌 0

It's time for a new version of phpmod.d - my library for painless #PHP extensions in D language.
github.com/kaja47/phpmo...

Summary here margaras.k47.cz/@k47/statuse...

Briefly: docs, debug build, multiple PHP versions, parity testing with PHP source, -fno-druntime, variadic functions and more.

03.04.2025 18:31 — 👍 1    🔁 0    💬 0    📌 0
Wikipedické faktoidy #13 (válka, atentáty, konspirace, další války a hyperinflace) Nikdy nevím, kam mě putování wikipedií zavede. Začal jsem na stránce o klapkách na oči a přes seznam atentátů na Hitlera a lokální války, co vypukly těsně po skončení první světové války, jsem se…

Wikipedické faktoidy #13 (válka, atentáty, konspirace, další války a hyperinflace) k47.cz/2025/wiki-fa...

31.03.2025 20:58 — 👍 0    🔁 0    💬 0    📌 0
Preview
GitHub - kaja47/phpmod.d: Write PHP extensions without unending misery of C, macros and PHP build system. Write PHP extensions without unending misery of C, macros and PHP build system. - kaja47/phpmod.d

I'm preparing new version of phpmod.d library for simple development of native #PHP extensions (github.com/kaja47/phpmo...) and so it's time to recap news in the current one:
margaras.k47.cz/@k47/statuse...

18.03.2025 14:25 — 👍 2    🔁 0    💬 0    📌 0

@k47q is following 1 prominent accounts