RE: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1

This WebDNA talk-list message is from

2019


It keeps the original formatting.
numero = 114940
interpreted = N
texte = 2568 --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Evaluates strings prior to numbers? From: Brian Fries Sent: 29 October 2019 17:59 To: WebDNA Talk Subject: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 I=92ve identified a bug with IF statement evaluation. My setup: Product: WebDNA - Enterprise Edition Version: 8.5.1 Platform: unix-Macintosh OS X Server OS: macOS 10.12.6 (16G2016) Also tested on: Product: WebDNA - Enterprise Edition Version: 8.5.1 Platform: unix-Macintosh OS X Server OS: macOS 10.14.6 (18G87) And on: Product: WebDNA (FastCGI) Version: 8.5.1 Platform: linux unix 64bits Server OS: Ubuntu 14.04.5 LTS I can code around the bug, so I don=92t need suggestions for other ways to = achieve my goals, I=92m just reporting inconsistent and incorrect behavior = by WebDNA. My code was testing for the presence of a page parameter which should eithe= r not be present or should have a numeric value greater than zero, dependin= g on how the user got to the page: [if ([pParam]>0)][then] * Got good parameter [/then][else] * No parameter, or invalid parameter [/else][/if] This worked fine, until I added an additional expression to the IF statemen= t: [text]list=3Done,two,three[/text] [if ("[list]"^"one") & ([pParam]>0)][then] TRUE * Got good parameter [/then][else] FALSE * No parameter, or invalid parameter, or list does not contain =93one= " [/else][/if] This example ALWAYS goes to the TRUE clause, unless the first expression fa= ils. Whether the second expression is TRUE or FALSE doesn=92t matter. For debugging, I simplified the components until I got to this, which incor= rectly executes the TRUE clause: [if (2=3D2) & (ABC>0)][then] TRUE [/then][else] FALSE [/else][/if] Testing the individual expressions, they both work correctly. (2=3D2) execu= tes the TRUE clause, while (ABC>0) executes the FALSE clause: [if (2=3D2)][then] TRUE [/then][else] FALSE [/else][/if] [if (ABC>0)][then] TRUE [/then][else] FALSE [/else][/if] Interestingly, switching the order of the expressions, correctly evaluates = to the FALSE clause: [if (ABC>0) & (2=3D2)][then] TRUE [/then][else] FALSE [/else][/if] Thanks, Brian Fries --------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To= unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Evaluates strings prior to numbers?

 

From: Brian Fries
Sent: 29 October 2019 17:59
To: WebDNA Talk
Subject: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1

 

I=92ve identified a bug with IF statement evaluation. My se= tup:

Product: WebDNA - Enterprise Edition
Version: 8.5.1
Platform: unix-Macintosh OS X
Server OS: macOS 10.12.6 (16G2016)

Also tested on:
Product: WebDNA - Enterprise Edition
Version: 8.5.1
Platform: unix-Macintosh OS X
Server OS: macOS 10.14.6 (18G87)

And on:
Product: WebDNA (FastCGI)
Version: 8.5.1
Platform: linux unix 64bits
Server OS: Ubuntu 14.04.5 LTS


I can code around the bug, so I don=92t need suggestions fo= r other ways to achieve my goals, I=92m just reporting inconsistent and inc= orrect behavior by WebDNA.

My code was testing for the presence of a page parameter wh= ich should either not be present or should have a numeric value greater tha= n zero, depending on how the user got to the page:

[if ([pParam]>0)][then= ]
* Got good parameter
[/then][else]
* No parameter, or i= nvalid parameter
[/else][/if]

This worked fine, until I added an additional expression to= the IF statement:

[text]list=3Done,two,thre= e[/text]
[if ("[list]"^&= quot;one") & ([pParam]>0)][then]
TRUE * Got good parameter=
[/then][else]
FALSE * No parameter= , or invalid parameter, or list does not contain =93one"
[/else][/if]

This example ALWAYS goes to the TRUE clause, unless the fir= st expression fails. Whether the second expression is TRUE or FALSE doesn= =92t matter.

For debugging, I simplified the components until I got to t= his, which incorrectly executes the TRUE clause:

[if (2=3D2= ) & (ABC>0)][then]
TRUE
[/then][else]
FALSE
[/else][/if]

Testing the individual expressions, they both work correctly. (2=3D2) execu= tes the TRUE clause, while (ABC>0) executes the FALSE clause:

[if (2=3D2)][then]=
TRUE
[/then][else]
FALSE
[/else][/if]

[if (ABC&g= t;0)][then]
TRUE
[/then][else]
FALSE
[/else][/if]


Interestingly, switching the order of the expressions, corr= ectly evaluates to the FALSE clause:

[if (ABC>0) & (2=3D= 2)][then]
TRUE
[/then][else]
FALSE
[/else][/if]


Thanks,
Brian Fries

--------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To= unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list talk@webdna.us To unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.us/page.dna?numero=3D55 Bug Reporting: support@webdna.us --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_-- . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 (Brian Fries 2019)
  2. RE: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 ("Scott @ Itsula" 2019)
  3. Re: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 (Donovan Brooke 2019)
  4. Re: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 (Brian Fries 2019)
  5. RE: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 ("Scott @ Itsula" 2019)
2568 --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Evaluates strings prior to numbers? From: Brian Fries Sent: 29 October 2019 17:59 To: WebDNA Talk Subject: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1 I=92ve identified a bug with IF statement evaluation. My setup: Product: WebDNA - Enterprise Edition Version: 8.5.1 Platform: unix-Macintosh OS X Server OS: macOS 10.12.6 (16G2016) Also tested on: Product: WebDNA - Enterprise Edition Version: 8.5.1 Platform: unix-Macintosh OS X Server OS: macOS 10.14.6 (18G87) And on: Product: WebDNA (FastCGI) Version: 8.5.1 Platform: linux unix 64bits Server OS: Ubuntu 14.04.5 LTS I can code around the bug, so I don=92t need suggestions for other ways to = achieve my goals, I=92m just reporting inconsistent and incorrect behavior = by WebDNA. My code was testing for the presence of a page parameter which should eithe= r not be present or should have a numeric value greater than zero, dependin= g on how the user got to the page: [if ([pParam]>0)][then] * Got good parameter [/then][else] * No parameter, or invalid parameter [/else][/if] This worked fine, until I added an additional expression to the IF statemen= t: [text]list=3Done,two,three[/text] [if ("[list]"^"one") & ([pParam]>0)][then] TRUE * Got good parameter [/then][else] FALSE * No parameter, or invalid parameter, or list does not contain =93one= " [/else][/if] This example ALWAYS goes to the TRUE clause, unless the first expression fa= ils. Whether the second expression is TRUE or FALSE doesn=92t matter. For debugging, I simplified the components until I got to this, which incor= rectly executes the TRUE clause: [if (2=3D2) & (ABC>0)][then] TRUE [/then][else] FALSE [/else][/if] Testing the individual expressions, they both work correctly. (2=3D2) execu= tes the TRUE clause, while (ABC>0) executes the FALSE clause: [if (2=3D2)][then] TRUE [/then][else] FALSE [/else][/if] [if (ABC>0)][then] TRUE [/then][else] FALSE [/else][/if] Interestingly, switching the order of the expressions, correctly evaluates = to the FALSE clause: [if (ABC>0) & (2=3D2)][then] TRUE [/then][else] FALSE [/else][/if] Thanks, Brian Fries --------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To= unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Evaluates strings prior to numbers?

 

From: Brian Fries
Sent: 29 October 2019 17:59
To: WebDNA Talk
Subject: [WebDNA] IF statement evaluation bug report, WebDNA 8.5.1

 

I=92ve identified a bug with IF statement evaluation. My se= tup:

Product: WebDNA - Enterprise Edition
Version: 8.5.1
Platform: unix-Macintosh OS X
Server OS: macOS 10.12.6 (16G2016)

Also tested on:
Product: WebDNA - Enterprise Edition
Version: 8.5.1
Platform: unix-Macintosh OS X
Server OS: macOS 10.14.6 (18G87)

And on:
Product: WebDNA (FastCGI)
Version: 8.5.1
Platform: linux unix 64bits
Server OS: Ubuntu 14.04.5 LTS


I can code around the bug, so I don=92t need suggestions fo= r other ways to achieve my goals, I=92m just reporting inconsistent and inc= orrect behavior by WebDNA.

My code was testing for the presence of a page parameter wh= ich should either not be present or should have a numeric value greater tha= n zero, depending on how the user got to the page:

[if ([pParam]>0)][then= ]
* Got good parameter
[/then][else]
* No parameter, or i= nvalid parameter
[/else][/if]

This worked fine, until I added an additional expression to= the IF statement:

[text]list=3Done,two,thre= e[/text]
[if ("[list]"^&= quot;one") & ([pParam]>0)][then]
TRUE * Got good parameter=
[/then][else]
FALSE * No parameter= , or invalid parameter, or list does not contain =93one"
[/else][/if]

This example ALWAYS goes to the TRUE clause, unless the fir= st expression fails. Whether the second expression is TRUE or FALSE doesn= =92t matter.

For debugging, I simplified the components until I got to t= his, which incorrectly executes the TRUE clause:

[if (2=3D2= ) & (ABC>0)][then]
TRUE
[/then][else]
FALSE
[/else][/if]

Testing the individual expressions, they both work correctly. (2=3D2) execu= tes the TRUE clause, while (ABC>0) executes the FALSE clause:

[if (2=3D2)][then]=
TRUE
[/then][else]
FALSE
[/else][/if]

[if (ABC&g= t;0)][then]
TRUE
[/then][else]
FALSE
[/else][/if]


Interestingly, switching the order of the expressions, corr= ectly evaluates to the FALSE clause:

[if (ABC>0) & (2=3D= 2)][then]
TRUE
[/then][else]
FALSE
[/else][/if]


Thanks,
Brian Fries

--------------------------------------------------------- This message is s= ent to you because you are subscribed to the mailing list talk@webdna.us To= unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.u= s/page.dna?numero=3D55 Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list talk@webdna.us To unsubscribe, E-mail to: talk-leave@webdna.us archives: http://www.webdna.us/page.dna?numero=3D55 Bug Reporting: support@webdna.us --_000_LO3P123MB3115FDBE696EBDF355B7C21D81610LO3P123MB3115GBRP_-- . "Scott @ Itsula"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

PIXO support (1997) RAM variables (1997) Help name our technology! (1997) [WebDNA] Mailing list failure? Nope, Google SPAM control !!! (2019) Insert Line Feed Character (2004) search context w shownext works! (1997) wee problem (2001) Determining Method (2000) Location of Webcat site in folder hierarchy (1997) Not reading code (1997) carriage returns in data (1997) math and european notation (1998) Unexpected comparison behavior change in 4.5.1 (2003) Arrays (2000) Performance Tuning (2006) Passing WebCat Vars with Javascript (2000) Unexpected error (1997) Deleting Orders (1997) [WebDNA] Yet another call for hosts... (2009) WebCat2 - Getting to the browser's username/password data (1997)