On 2026-11-20, Arne Vajhøj <ar…@vajhoej.dk> wrote:
> On 11/20/2026 3:10 PM, Simon Clubley wrote:
>> On 2026-11-20, Arne Vajhøj <ar…@vajhoej.dk> wrote:
>>> On 11/19/2026 4:25 PM, Arne Vajhøj wrote:
>>>> echo file_get_contents("http://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
>>>> //echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
>>>> echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx", false,
>>>> stream_context_create($sslctxopts)) . "\n";
>>>> echo file_get_contents("HTTPS://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
>>>> echo file_get_contents("httpS://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
>>>
>>>> $ php another.php
>>>> Port = 80
>>>> Port = 443
>>>> Port = 80
>>>> Port = 80
>>> And for the curious - before fix:
>>>
>>> use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
>>> ZSTR_VAL(resource->scheme)[4] == 's';
>>
>> I really hope that line was always compiled by a short-circuiting
>> compiler and that line always successfully triggered short-circuiting...
>>
>> Don't be surprised if everyone is now looking for similar constructs
>> that rely on short-circuiting to be safe.
> Doesn't C require/mandate short circuiting in cases like this??
>
As Dan has pointed out, yes. However, I absolutely hate that style of
coding (and the use of short circuiting in general) - it is way too fragile.
It depends on the compiler behaving as expected and it depends on someone
not making some edit change that happens to have the unexpected side-effect
of disabling any working short circuiting.
Seriously. Please consider not using short circuiting and instead writing
your code so it works regardless of whether your compiler short-circuits
or not. (Or it suddenly decides to stop short-circuiting one day).
Oh, and before you all start mocking me, please read this:
https://www.redhat.com/en/blog/security-flaws-caused-compiler-optimizations
Even Linux has been caught out in the past by compilers not behaving
as expected.
Simon.
--
Simon Clubley, club…@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.