🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.vms
Article #232

Re: More PHP vulnerabilities

#232
From: Arne Vajhøj
Date: Sun, 22 Nov 2026 01:25
111 lines
4249 bytes
On 11/21/2026 6:58 PM, Dan Cross wrote:
> In article <6b021bab$0$672$14726298@news.sunsite.dk>,
> Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 11/20/2026 3:24 PM, Arne Vajhøj wrote:
>>> On 11/20/2026 3:10 PM, Simon Clubley wrote:
>>>> [snip]
>>> Doesn't C require/mandate short circuiting in cases like this??
>>
>> I believe the VMS landscape looks like:
>>
>>               Undefined(*) L to R    L to R
>>                            all       short circuit
>> [snip]
>> VMS Fortran  .and.
>>               .or.
>> VMS Pascal   and                    and_then
>>               or                     or_else
>> C                         &         &&
>>                            |         ||
>> Ada          and                    and then
>>               or                     or else
>> Java                      &         &&
>>                            |         ||
>> Python                    &         and
>>                            |         or
>> PHP                       &         &&
>>                            |         ||
>>                                      and(**)
>>                                      or(**)
>> [snip]
> 
> For C, Java, Python, and (probably?) PHP, you are mixing up
> different categories of operators: `&` and `|` are bitwise
> operators in those languages, while `&&` and `||` are boolean
> operators.  Since they are intended to do differnt things, the
> semantics are different.

Those 4 are a bit different.

Java has both bitwise & and | on integer types and logical & and | on
booleans.

In C and Python bool are sort of an int so bitwise and logical
are the same.

PHP just auto converts booleans to ints for bitwise operator.

But all 4 quacks like a duck.

> I doubt that there are many many languages that would introduce
> short-circuiting behavior for bitwise operators.  But note also
> that we may see behaviors like this:
> 
> ```c
> 	#include <stdio.h>
> 	int
> 	main(void)
> 	{
> 		int a = 1, b = 2;
> 
> 		if (a)
> 			printf("a is true\n");
> 		if (b)
> 			printf("b is true\n");
> 		if (a & b)
> 			printf("both are true\n");
> 		else
> 			printf("but `&` is not a boolean operator\n");
> 
> 		return 0;
> 	}
> ```
Good point.

The problem here is the use of int instead of bool.

#include <stdio.h>
#include <stdbool.h>

int main()
{
     bool a = 1, b = 2;

     if (a)
         printf("a is true\n");
     if (b)
         printf("b is true\n");
     if (a & b)
         printf("both are true\n");
     else
         printf("but `&` is not a boolean operator\n");

     return 0;
}

Outputs a different result.

But treating int's as booleans is an integrated part
of C.

And it has spilled over to many other languages.

So yes - if working with int's instead of bool's,
then bitwise operators can not be used as logical
operators.

Arne



Technical Details
Message-ID: <11dtg8h$isan$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11dnpep$2kvk6$2@dont-email.me> <11dq9gg$3ghpm$1@dont-email.me> <11dqa7g$3guqc$1@dont-email.me> <6b021bab$0$672$14726298@news.sunsite.dk> <11dtb70$t8$1@reader2.panix.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Arne Vajhøj <arne@vajhoej.dk>
Newsgroups: comp.os.vms
Subject: Re: More PHP vulnerabilities
Date: Sat, 21 Nov 2026 20:25:26 -0500
Organization: A noiseless patient Spider
Lines: 111
Message-ID: <11dtg8h$isan$1@dont-email.me>
References: <11dnpep$2kvk6$2@dont-email.me> <11dq9gg$3ghpm$1@dont-email.me>
 <11dqa7g$3guqc$1@dont-email.me> <6b021bab$0$672$14726298@news.sunsite.dk>
 <11dtb70$t8$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 22 Nov 2026 01:24:34 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="618839"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+VXPW9r1qnZxIeyQ08nGxp0EoSIIqDKgM="; posting-host="82db7eb1b2e9e4e1ea30d8c5f66f37dc"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gqa9fCvbg/gQYw7yYuJ/SMjpDe0= sha256:DxtqQW6MmKqBLtTCaWeit/l9KPl/uXaFg8O6yvbmd24=
	sha1:iHr9bgaBWVTakc++p2mpi0uFweU= sha256:CyOG2OaTMdHAqyBzsletmtfnjjRBydww362I581ZTsw=
In-Reply-To: <11dtb70$t8$1@reader2.panix.com>
Content-Language: en-US