[{"Id":11199,"Author":{"Name":"Lyle Seaman","FirstName":"Lyle","ShortDescription":"networking, security infra and filesystems kernel hacker turned application programmer, SRE and engineering manager, Lyle traded tilting at windmills for viking at Vikings but couldn\u0027t catch any.","DescriptionHtml":null,"Slug":"lyle-seaman","IsAdmin":true,"IsActive":true,"ImageUrl":"/images/imageslws/viking.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003e\u0026#34;Scammer offers to buy Google\u0026#34; is certainly a new twist on a very old New York con.\n\u003cstrong\u003eJan B.\u003c/strong\u003e explains\n\u0026#34;Scammers have found a new way to steal money, scrap\nLinkedIn profiles and then send out emails with fake offers\nto buy people\u0026#39;s companies. I\u0026#39;m guessing suddenly they need some\nfees paid just before the deal is finalised. However, they\nmay need to improve their filtering before sending out their\nscams, I don\u0026#39;t even own Google!\u0026#34; I\u0026#39;m putting together a group of people\nto buy it, do you want to get in the deal? I\u0026#39;ll just need you to transfer\ntwo million to this SWIFT account...  \n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#5ecf5d704e7742b38d3467e98c8cc631\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"5ecf5d704e7742b38d3467e98c8cc631\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/5ecf5d704e7742b38d3467e98c8cc631.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003c/blockquote\u003e","BodyHtml":"\u003cp\u003e\u0026#34;Scammer offers to buy Google\u0026#34; is certainly a new twist on a very old New York con.\n\u003cstrong\u003eJan B.\u003c/strong\u003e explains\n\u0026#34;Scammers have found a new way to steal money, scrap\nLinkedIn profiles and then send out emails with fake offers\nto buy people\u0026#39;s companies. I\u0026#39;m guessing suddenly they need some\nfees paid just before the deal is finalised. However, they\nmay need to improve their filtering before sending out their\nscams, I don\u0026#39;t even own Google!\u0026#34; I\u0026#39;m putting together a group of people\nto buy it, do you want to get in the deal? I\u0026#39;ll just need you to transfer\ntwo million to this SWIFT account...  \n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#5ecf5d704e7742b38d3467e98c8cc631\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"5ecf5d704e7742b38d3467e98c8cc631\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/5ecf5d704e7742b38d3467e98c8cc631.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;But when?\u0026#34; queries\n\u003cstrong\u003eHercules\u003c/strong\u003e\n\u0026#34;I\u0026#39;ve always had difficulty understanding phone billing and payment cycles.\nMy phone company seems intent on making that harder...\u0026#34;  Strong, heroically good-looking... Bright?The gods don\u0026#39;t require it.\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#bffc573e6abf42c694a6e8194f66f9a9\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"bffc573e6abf42c694a6e8194f66f9a9\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/bffc573e6abf42c694a6e8194f66f9a9.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;Next update: 25 years 11 months ago\u0026#34; is some kind of reverse Y2K bug. \n\u003cstrong\u003eLaurent\u003c/strong\u003e boggles\n\u0026#34;It\u0026#39;s bad enough to have a power outage, but to\nhave to go back in time to get an update?\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#f700091cccad4fc4b0764fad047f3149\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"f700091cccad4fc4b0764fad047f3149\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/f700091cccad4fc4b0764fad047f3149.jpeg\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;What is 30% of NaN?\u0026#34; asks \n\u003cstrong\u003eGeoff O.\u003c/strong\u003e rhetorically.  However, the answer is well-defined and explicit.\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#099fa3a714f8449fbf59e345e72caa9c\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"099fa3a714f8449fbf59e345e72caa9c\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/099fa3a714f8449fbf59e345e72caa9c.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003eAnd finally, another \u0026#34;lost in translation\u0026#34; error from \n\u003cstrong\u003eMartin K.\u003c/strong\u003e: \n\u0026#34;Not only have the store not changed the generic cookie\nbar text, they apparently don\u0026#39;t have a fall back to\ne.g. english, if the browser language isn\u0026#39;t found.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#354cdc680a3e425f9ea752ae57c1da73\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"354cdc680a3e425f9ea752ae57c1da73\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/354cdc680a3e425f9ea752ae57c1da73.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n","BodyAndAdHtml":"\u003cp\u003e\u0026#34;Scammer offers to buy Google\u0026#34; is certainly a new twist on a very old New York con.\n\u003cstrong\u003eJan B.\u003c/strong\u003e explains\n\u0026#34;Scammers have found a new way to steal money, scrap\nLinkedIn profiles and then send out emails with fake offers\nto buy people\u0026#39;s companies. I\u0026#39;m guessing suddenly they need some\nfees paid just before the deal is finalised. However, they\nmay need to improve their filtering before sending out their\nscams, I don\u0026#39;t even own Google!\u0026#34; I\u0026#39;m putting together a group of people\nto buy it, do you want to get in the deal? I\u0026#39;ll just need you to transfer\ntwo million to this SWIFT account...  \n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#5ecf5d704e7742b38d3467e98c8cc631\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"5ecf5d704e7742b38d3467e98c8cc631\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/5ecf5d704e7742b38d3467e98c8cc631.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;But when?\u0026#34; queries\n\u003cstrong\u003eHercules\u003c/strong\u003e\n\u0026#34;I\u0026#39;ve always had difficulty understanding phone billing and payment cycles.\nMy phone company seems intent on making that harder...\u0026#34;  Strong, heroically good-looking... Bright?The gods don\u0026#39;t require it.\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#bffc573e6abf42c694a6e8194f66f9a9\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"bffc573e6abf42c694a6e8194f66f9a9\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/bffc573e6abf42c694a6e8194f66f9a9.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;Next update: 25 years 11 months ago\u0026#34; is some kind of reverse Y2K bug. \n\u003cstrong\u003eLaurent\u003c/strong\u003e boggles\n\u0026#34;It\u0026#39;s bad enough to have a power outage, but to\nhave to go back in time to get an update?\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#f700091cccad4fc4b0764fad047f3149\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"f700091cccad4fc4b0764fad047f3149\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/f700091cccad4fc4b0764fad047f3149.jpeg\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003e\u0026#34;What is 30% of NaN?\u0026#34; asks \n\u003cstrong\u003eGeoff O.\u003c/strong\u003e rhetorically.  However, the answer is well-defined and explicit.\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#099fa3a714f8449fbf59e345e72caa9c\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"099fa3a714f8449fbf59e345e72caa9c\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/099fa3a714f8449fbf59e345e72caa9c.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cp\u003eAnd finally, another \u0026#34;lost in translation\u0026#34; error from \n\u003cstrong\u003eMartin K.\u003c/strong\u003e: \n\u0026#34;Not only have the store not changed the generic cookie\nbar text, they apparently don\u0026#39;t have a fall back to\ne.g. english, if the browser language isn\u0026#39;t found.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#354cdc680a3e425f9ea752ae57c1da73\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"354cdc680a3e425f9ea752ae57c1da73\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/354cdc680a3e425f9ea752ae57c1da73.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\n\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Self_Service\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eBuildMaster\u003c/a\u003e allows you to create a self-service release management platform that allows different teams to manage their applications. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Self_Service\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eExplore how!\u003c/a\u003e \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"Bridge for Sale","RssTitle":"Error\u0027d: Bridge for Sale","CachedCommentCount":9,"LastCommentDate":"\/Date(1780715006367)\/","LastCommentDateDescription":"03:03","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780641000000)\/","ISODate":"2026-06-05","DisplayDate":"2026-06-05","Series":{"Slug":"errord","Title":"Error\u0027d","Description":"Error\u0027d features fun error messages and other visual oddities from the world of IT.","CssClass":"errord"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Self_Service\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eBuildMaster\u003c/a\u003e allows you to create a self-service release management platform that allows different teams to manage their applications. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Self_Service\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eExplore how!\u003c/a\u003e \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/bridge-for-sale","CommentsUrl":"https://thedailywtf.com/articles/comments/bridge-for-sale","Slug":"bridge-for-sale","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fbridge-for-sale+-+Bridge+for+Sale+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fbridge-for-sale\u0026t=Bridge+for+Sale+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Bridge%20for%20Sale:%20https://thedailywtf.com/articles/bridge-for-sale","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fbridge-for-sale","PreviousArticleId":11197,"PreviousArticleTitle":"Build Up","PreviousArticleSlug":"build-up","PreviousArticleUrl":"//thedailywtf.com/articles/build-up","NextArticleId":null,"NextArticleTitle":null,"NextArticleSlug":null,"NextArticleUrl":"//thedailywtf.com/articles/"},{"Id":11197,"Author":{"Name":"Remy Porter","FirstName":"Remy","ShortDescription":"Computers were a mistake, so I accidentally became a farmer? Editor-in-Chief for TDWTF.","DescriptionHtml":"\u003cp\u003eRemy is a veteran developer who writes software for farming robots. They pick tomatoes.\u003c/p\u003e\r\n\u003cp\u003eHe\u0027s often on stage, doing improv comedy, but insists that \u003cem\u003ehe\u003c/em\u003e isn\u0027t doing comedy- it\u0027s deadly serious. You\u0027re laughing at him, not with him. That, by the way, is usually true- you\u0027re laughing at him, not with him.\u003c/p\u003e","Slug":"remy-porter","IsAdmin":true,"IsActive":true,"ImageUrl":"https://s3.amazonaws.com/remy.jetpackshark.com/remy-thumb.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003eIf there\u0026#39;s one thing that seems to be a constant source of issues, it\u0026#39;s people constructing SQL queries through string concatenation. Even if you\u0026#39;re using parameters in the query, I\u0026#39;m opposed to handling raw SQL as strings in my programs. My solution is always \u0026#34;use a builder\u0026#34;- an API that constructs a syntax tree that it can then \u003cem\u003erender\u003c/em\u003e to SQL as needed. (Yes, a builder, not an ORM, that\u0026#39;s a whole \u003cem\u003eother\u003c/em\u003e discussion, I\u0026#39;m not dogmatically \u003cem\u003eanti\u003c/em\u003e-ORM, but it\u0026#39;s a leaky abstraction at best.)\u003c/p\u003e\n\u003cp\u003eMany languages have such a thing, Java included. \u003cstrong\u003eLukasz\u003c/strong\u003e\u0026#39;s team was using Java, and they had a rule: \u0026#34;don\u0026#39;t do SQL strings, use a builder\u0026#34;. Unfortunately for Lukasz\u0026#39;s team, their guideline didn\u0026#39;t specify what \u003cem\u003ekind\u003c/em\u003e of builder.\u003c/p\u003e\n","BodyHtml":"\u003cp\u003eIf there\u0026#39;s one thing that seems to be a constant source of issues, it\u0026#39;s people constructing SQL queries through string concatenation. Even if you\u0026#39;re using parameters in the query, I\u0026#39;m opposed to handling raw SQL as strings in my programs. My solution is always \u0026#34;use a builder\u0026#34;- an API that constructs a syntax tree that it can then \u003cem\u003erender\u003c/em\u003e to SQL as needed. (Yes, a builder, not an ORM, that\u0026#39;s a whole \u003cem\u003eother\u003c/em\u003e discussion, I\u0026#39;m not dogmatically \u003cem\u003eanti\u003c/em\u003e-ORM, but it\u0026#39;s a leaky abstraction at best.)\u003c/p\u003e\n\u003cp\u003eMany languages have such a thing, Java included. \u003cstrong\u003eLukasz\u003c/strong\u003e\u0026#39;s team was using Java, and they had a rule: \u0026#34;don\u0026#39;t do SQL strings, use a builder\u0026#34;. Unfortunately for Lukasz\u0026#39;s team, their guideline didn\u0026#39;t specify what \u003cem\u003ekind\u003c/em\u003e of builder.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-java\"\u003e    \u003cspan class=\"hljs-type\"\u003eStringBuilder\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003ebuilder\u003c/span\u003e \u003cspan class=\"hljs-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e \u003cspan class=\"hljs-title class_\"\u003eStringBuilder\u003c/span\u003e();\n\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;where ID_BSNGP = ? \u0026#34;\u003c/span\u003e);\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;and ID_ITM = ? \u0026#34;\u003c/span\u003e);\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;for update\u0026#34;\u003c/span\u003e);\n\n    \u003cspan class=\"hljs-type\"\u003eSQLQuery\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003equery\u003c/span\u003e \u003cspan class=\"hljs-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e \u003cspan class=\"hljs-title class_\"\u003eSQLQuery\u003c/span\u003e();\n\n    query.setQueryString(builder.toString());\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eA \u003ccode\u003eStringBuilder\u003c/code\u003e is \u003cem\u003ea kind\u003c/em\u003e of builder. Technically correct and all that. It\u0026#39;s just concatenation with extra steps, but it\u0026#39;s a builder. Of course, the bonus point here is that this built query is… just wrong? \u003ccode\u003eSELECT FOR UPDATE field FROM table WHERE condition\u003c/code\u003e would make sense, but we\u0026#39;re missing most of that syntax here.\u003c/p\u003e\n\u003cp\u003eThat this code was running in production without anyone noticing means that whatever errors this was triggering were getting swallowed or ignored, \u003cem\u003eand\u003c/em\u003e the fact that no good output ever came from it ended up not mattering. The real WTF is less the malicious compliance and more the fact that this obviously broken code wasn\u0026#39;t so broken as to be \u003cem\u003enoticed\u003c/em\u003e.\u003c/p\u003e\n\u003c!-- Easy Reader Version: easy_reader.description(\"This sums up the article\").expansion(\"by highlighting the absurdity of it\").conclusion(\"let\u0027s not ever write SQL directly\").build() --\u003e","BodyAndAdHtml":"\u003cp\u003eIf there\u0026#39;s one thing that seems to be a constant source of issues, it\u0026#39;s people constructing SQL queries through string concatenation. Even if you\u0026#39;re using parameters in the query, I\u0026#39;m opposed to handling raw SQL as strings in my programs. My solution is always \u0026#34;use a builder\u0026#34;- an API that constructs a syntax tree that it can then \u003cem\u003erender\u003c/em\u003e to SQL as needed. (Yes, a builder, not an ORM, that\u0026#39;s a whole \u003cem\u003eother\u003c/em\u003e discussion, I\u0026#39;m not dogmatically \u003cem\u003eanti\u003c/em\u003e-ORM, but it\u0026#39;s a leaky abstraction at best.)\u003c/p\u003e\n\u003cp\u003eMany languages have such a thing, Java included. \u003cstrong\u003eLukasz\u003c/strong\u003e\u0026#39;s team was using Java, and they had a rule: \u0026#34;don\u0026#39;t do SQL strings, use a builder\u0026#34;. Unfortunately for Lukasz\u0026#39;s team, their guideline didn\u0026#39;t specify what \u003cem\u003ekind\u003c/em\u003e of builder.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-java\"\u003e    \u003cspan class=\"hljs-type\"\u003eStringBuilder\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003ebuilder\u003c/span\u003e \u003cspan class=\"hljs-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e \u003cspan class=\"hljs-title class_\"\u003eStringBuilder\u003c/span\u003e();\n\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;where ID_BSNGP = ? \u0026#34;\u003c/span\u003e);\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;and ID_ITM = ? \u0026#34;\u003c/span\u003e);\n    builder.append(\u003cspan class=\"hljs-string\"\u003e\u0026#34;for update\u0026#34;\u003c/span\u003e);\n\n    \u003cspan class=\"hljs-type\"\u003eSQLQuery\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003equery\u003c/span\u003e \u003cspan class=\"hljs-operator\"\u003e=\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003enew\u003c/span\u003e \u003cspan class=\"hljs-title class_\"\u003eSQLQuery\u003c/span\u003e();\n\n    query.setQueryString(builder.toString());\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eA \u003ccode\u003eStringBuilder\u003c/code\u003e is \u003cem\u003ea kind\u003c/em\u003e of builder. Technically correct and all that. It\u0026#39;s just concatenation with extra steps, but it\u0026#39;s a builder. Of course, the bonus point here is that this built query is… just wrong? \u003ccode\u003eSELECT FOR UPDATE field FROM table WHERE condition\u003c/code\u003e would make sense, but we\u0026#39;re missing most of that syntax here.\u003c/p\u003e\n\u003cp\u003eThat this code was running in production without anyone noticing means that whatever errors this was triggering were getting swallowed or ignored, \u003cem\u003eand\u003c/em\u003e the fact that no good output ever came from it ended up not mattering. The real WTF is less the malicious compliance and more the fact that this obviously broken code wasn\u0026#39;t so broken as to be \u003cem\u003enoticed\u003c/em\u003e.\u003c/p\u003e\n\u003c!-- Easy Reader Version: easy_reader.description(\"This sums up the article\").expansion(\"by highlighting the absurdity of it\").conclusion(\"let\u0027s not ever write SQL directly\").build() --\u003e\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"Build Up","RssTitle":"CodeSOD: Build Up","CachedCommentCount":13,"LastCommentDate":"\/Date(1780716887473)\/","LastCommentDateDescription":"03:34","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780554600000)\/","ISODate":"2026-06-04","DisplayDate":"2026-06-04","Series":{"Slug":"code-sod","Title":"CodeSOD","Description":"Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.","CssClass":"code"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/build-up","CommentsUrl":"https://thedailywtf.com/articles/comments/build-up","Slug":"build-up","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fbuild-up+-+Build+Up+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fbuild-up\u0026t=Build+Up+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Build%20Up:%20https://thedailywtf.com/articles/build-up","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fbuild-up","PreviousArticleId":11196,"PreviousArticleTitle":"Coerce the Truth Out of You","PreviousArticleSlug":"coerce-the-truth-out-of-you","PreviousArticleUrl":"//thedailywtf.com/articles/coerce-the-truth-out-of-you","NextArticleId":11199,"NextArticleTitle":"Bridge for Sale","NextArticleSlug":"bridge-for-sale","NextArticleUrl":"//thedailywtf.com/articles/bridge-for-sale"},{"Id":11196,"Author":{"Name":"Remy Porter","FirstName":"Remy","ShortDescription":"Computers were a mistake, so I accidentally became a farmer? Editor-in-Chief for TDWTF.","DescriptionHtml":"\u003cp\u003eRemy is a veteran developer who writes software for farming robots. They pick tomatoes.\u003c/p\u003e\r\n\u003cp\u003eHe\u0027s often on stage, doing improv comedy, but insists that \u003cem\u003ehe\u003c/em\u003e isn\u0027t doing comedy- it\u0027s deadly serious. You\u0027re laughing at him, not with him. That, by the way, is usually true- you\u0027re laughing at him, not with him.\u003c/p\u003e","Slug":"remy-porter","IsAdmin":true,"IsActive":true,"ImageUrl":"https://s3.amazonaws.com/remy.jetpackshark.com/remy-thumb.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003e\u003cstrong\u003eFrank\u003c/strong\u003e suspected something odd when he spotted a use of React\u0026#39;s \u003ccode\u003euseMemo\u003c/code\u003e function in some JavaScript code. Now, there\u0026#39;s nothing \u003cem\u003ewrong\u003c/em\u003e with using that method, in and of itself. It watches some variables and recalculates a callback if they change for any reason. It\u0026#39;s a great tool for when you want to avoid recalculating expensive things over and over again.\u003c/p\u003e\n\u003cp\u003eBut in this case, the calculation in question was \u003ccode\u003eisAuthorized\u003c/code\u003e, which wasn\u0026#39;t an expensive calculation; it was just checking if certain values are set. The code looked like this:\u003c/p\u003e\n","BodyHtml":"\u003cp\u003e\u003cstrong\u003eFrank\u003c/strong\u003e suspected something odd when he spotted a use of React\u0026#39;s \u003ccode\u003euseMemo\u003c/code\u003e function in some JavaScript code. Now, there\u0026#39;s nothing \u003cem\u003ewrong\u003c/em\u003e with using that method, in and of itself. It watches some variables and recalculates a callback if they change for any reason. It\u0026#39;s a great tool for when you want to avoid recalculating expensive things over and over again.\u003c/p\u003e\n\u003cp\u003eBut in this case, the calculation in question was \u003ccode\u003eisAuthorized\u003c/code\u003e, which wasn\u0026#39;t an expensive calculation; it was just checking if certain values are set. The code looked like this:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-javascript\"\u003e  \u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e isAuthorized = \u003cspan class=\"hljs-title function_\"\u003euseMemo\u003c/span\u003e(\u003cspan class=\"hljs-function\"\u003e() =\u0026gt;\u003c/span\u003e {\n    \u003cspan class=\"hljs-keyword\"\u003ereturn\u003c/span\u003e (session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; !group) === \u003cspan class=\"hljs-literal\"\u003efalse\u003c/span\u003e;\n  }, [session, token, group]);\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003ccode\u003esession\u003c/code\u003e, \u003ccode\u003etoken\u003c/code\u003e and \u003ccode\u003egroup\u003c/code\u003e are all either going to be null, or be an object. To be authorized, all three must be set to non-null values. A rational person, knowing this, might choose to \u003ccode\u003ereturn session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; group\u003c/code\u003e, and exploit JavaScript\u0026#39;s truthiness. Or, if you really wanted to coerce it to a boolean, you could \u003ccode\u003ereturn !!(session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; group)\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSo why on Earth are they negating \u003ccode\u003egroup\u003c/code\u003e? How would this even work? If the check is \u0026#34;all three must be set\u0026#34; what is this doing?\u003c/p\u003e\n\u003cp\u003eWell, if you do \u003ccode\u003ea \u0026amp;\u0026amp; b \u0026amp;\u0026amp; c\u003c/code\u003e, JavaScript will return the last value you looked at. The \u003ccode\u003e\u0026amp;\u0026amp;\u003c/code\u003e operator short circuits, so that means it either returns the first falsy value you encounter, \u003cem\u003eor\u003c/em\u003e the very last value in the chain.\u003c/p\u003e\n\u003cp\u003eSo in this scenario: \u003ccode\u003e(session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; !group)\u003c/code\u003e, if \u003ccode\u003esession\u003c/code\u003e or \u003ccode\u003etoken\u003c/code\u003e is \u003ccode\u003enull\u003c/code\u003e, the expression evaluates to \u003ccode\u003enull\u003c/code\u003e. Otherwise, if \u003ccode\u003egroup\u003c/code\u003e is \u003ccode\u003enull\u003c/code\u003e, then \u003ccode\u003e!group\u003c/code\u003e will evaluate to \u003ccode\u003etrue\u003c/code\u003e. Because they use the \u003ccode\u003e===\u003c/code\u003e operator, JavaScript won\u0026#39;t do any type coercion, and that means \u003ccode\u003enull === false\u003c/code\u003e is false, as is \u003ccode\u003etrue === false\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eI can\u0026#39;t believe that this code works as \u003cem\u003eintended\u003c/em\u003e. I mean, it works, it gives the correct output, but I think that\u0026#39;s an accident. Happenstance of someone with no clue gradually throwing operators into an expression until it does what they want. Perhaps it\u0026#39;s LLM generated code- who can even guess anymore? It certainly seems like it was generated through a stochastic process; whether that\u0026#39;s a bumbling developer or a bunch of math, there\u0026#39;s definitely no \u003cem\u003eintelligence\u003c/em\u003e involved, artificial or otherwise.\u003c/p\u003e\n\u003c!-- Easy Reader Version: (easy \u0026\u0026 reader \u0026\u0026 !false) --\u003e","BodyAndAdHtml":"\u003cp\u003e\u003cstrong\u003eFrank\u003c/strong\u003e suspected something odd when he spotted a use of React\u0026#39;s \u003ccode\u003euseMemo\u003c/code\u003e function in some JavaScript code. Now, there\u0026#39;s nothing \u003cem\u003ewrong\u003c/em\u003e with using that method, in and of itself. It watches some variables and recalculates a callback if they change for any reason. It\u0026#39;s a great tool for when you want to avoid recalculating expensive things over and over again.\u003c/p\u003e\n\u003cp\u003eBut in this case, the calculation in question was \u003ccode\u003eisAuthorized\u003c/code\u003e, which wasn\u0026#39;t an expensive calculation; it was just checking if certain values are set. The code looked like this:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-javascript\"\u003e  \u003cspan class=\"hljs-keyword\"\u003econst\u003c/span\u003e isAuthorized = \u003cspan class=\"hljs-title function_\"\u003euseMemo\u003c/span\u003e(\u003cspan class=\"hljs-function\"\u003e() =\u0026gt;\u003c/span\u003e {\n    \u003cspan class=\"hljs-keyword\"\u003ereturn\u003c/span\u003e (session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; !group) === \u003cspan class=\"hljs-literal\"\u003efalse\u003c/span\u003e;\n  }, [session, token, group]);\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003ccode\u003esession\u003c/code\u003e, \u003ccode\u003etoken\u003c/code\u003e and \u003ccode\u003egroup\u003c/code\u003e are all either going to be null, or be an object. To be authorized, all three must be set to non-null values. A rational person, knowing this, might choose to \u003ccode\u003ereturn session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; group\u003c/code\u003e, and exploit JavaScript\u0026#39;s truthiness. Or, if you really wanted to coerce it to a boolean, you could \u003ccode\u003ereturn !!(session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; group)\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSo why on Earth are they negating \u003ccode\u003egroup\u003c/code\u003e? How would this even work? If the check is \u0026#34;all three must be set\u0026#34; what is this doing?\u003c/p\u003e\n\u003cp\u003eWell, if you do \u003ccode\u003ea \u0026amp;\u0026amp; b \u0026amp;\u0026amp; c\u003c/code\u003e, JavaScript will return the last value you looked at. The \u003ccode\u003e\u0026amp;\u0026amp;\u003c/code\u003e operator short circuits, so that means it either returns the first falsy value you encounter, \u003cem\u003eor\u003c/em\u003e the very last value in the chain.\u003c/p\u003e\n\u003cp\u003eSo in this scenario: \u003ccode\u003e(session \u0026amp;\u0026amp; token \u0026amp;\u0026amp; !group)\u003c/code\u003e, if \u003ccode\u003esession\u003c/code\u003e or \u003ccode\u003etoken\u003c/code\u003e is \u003ccode\u003enull\u003c/code\u003e, the expression evaluates to \u003ccode\u003enull\u003c/code\u003e. Otherwise, if \u003ccode\u003egroup\u003c/code\u003e is \u003ccode\u003enull\u003c/code\u003e, then \u003ccode\u003e!group\u003c/code\u003e will evaluate to \u003ccode\u003etrue\u003c/code\u003e. Because they use the \u003ccode\u003e===\u003c/code\u003e operator, JavaScript won\u0026#39;t do any type coercion, and that means \u003ccode\u003enull === false\u003c/code\u003e is false, as is \u003ccode\u003etrue === false\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eI can\u0026#39;t believe that this code works as \u003cem\u003eintended\u003c/em\u003e. I mean, it works, it gives the correct output, but I think that\u0026#39;s an accident. Happenstance of someone with no clue gradually throwing operators into an expression until it does what they want. Perhaps it\u0026#39;s LLM generated code- who can even guess anymore? It certainly seems like it was generated through a stochastic process; whether that\u0026#39;s a bumbling developer or a bunch of math, there\u0026#39;s definitely no \u003cem\u003eintelligence\u003c/em\u003e involved, artificial or otherwise.\u003c/p\u003e\n\u003c!-- Easy Reader Version: (easy \u0026\u0026 reader \u0026\u0026 !false) --\u003e\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"Coerce the Truth Out of You","RssTitle":"CodeSOD: Coerce the Truth Out of You","CachedCommentCount":7,"LastCommentDate":"\/Date(1780509385770)\/","LastCommentDateDescription":"2026-06-03","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780468200000)\/","ISODate":"2026-06-03","DisplayDate":"2026-06-03","Series":{"Slug":"code-sod","Title":"CodeSOD","Description":"Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.","CssClass":"code"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/coerce-the-truth-out-of-you","CommentsUrl":"https://thedailywtf.com/articles/comments/coerce-the-truth-out-of-you","Slug":"coerce-the-truth-out-of-you","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fcoerce-the-truth-out-of-you+-+Coerce+the+Truth+Out+of+You+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fcoerce-the-truth-out-of-you\u0026t=Coerce+the+Truth+Out+of+You+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Coerce%20the%20Truth%20Out%20of%20You:%20https://thedailywtf.com/articles/coerce-the-truth-out-of-you","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fcoerce-the-truth-out-of-you","PreviousArticleId":11195,"PreviousArticleTitle":"Blocked the Date","PreviousArticleSlug":"blocked-the-date","PreviousArticleUrl":"//thedailywtf.com/articles/blocked-the-date","NextArticleId":11197,"NextArticleTitle":"Build Up","NextArticleSlug":"build-up","NextArticleUrl":"//thedailywtf.com/articles/build-up"},{"Id":11195,"Author":{"Name":"Remy Porter","FirstName":"Remy","ShortDescription":"Computers were a mistake, so I accidentally became a farmer? Editor-in-Chief for TDWTF.","DescriptionHtml":"\u003cp\u003eRemy is a veteran developer who writes software for farming robots. They pick tomatoes.\u003c/p\u003e\r\n\u003cp\u003eHe\u0027s often on stage, doing improv comedy, but insists that \u003cem\u003ehe\u003c/em\u003e isn\u0027t doing comedy- it\u0027s deadly serious. You\u0027re laughing at him, not with him. That, by the way, is usually true- you\u0027re laughing at him, not with him.\u003c/p\u003e","Slug":"remy-porter","IsAdmin":true,"IsActive":true,"ImageUrl":"https://s3.amazonaws.com/remy.jetpackshark.com/remy-thumb.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003e\u003cstrong\u003eVolodya\u003c/strong\u003e sends us some bad date handling code in PHP. Which, I know, you\u0026#39;re just reaching for the close tab and yawning when you hear that. You\u0026#39;ve seen it before. But bear with me, this one still has some fun bits to it.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-variable\"\u003e$monthes\u003c/span\u003e = \u003cspan class=\"hljs-keyword\"\u003earray\u003c/span\u003e(\n        \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Января\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e2\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Февраля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e3\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Марта\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e4\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Апреля\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e5\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Мая\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e6\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июня\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e7\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e8\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Августа\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e9\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Сентября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e10\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Октября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e11\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Ноября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e12\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Декабря\u0026#39;\u003c/span\u003e\n);\n\u003c/code\u003e\u003c/pre\u003e\n","BodyHtml":"\u003cp\u003e\u003cstrong\u003eVolodya\u003c/strong\u003e sends us some bad date handling code in PHP. Which, I know, you\u0026#39;re just reaching for the close tab and yawning when you hear that. You\u0026#39;ve seen it before. But bear with me, this one still has some fun bits to it.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-variable\"\u003e$monthes\u003c/span\u003e = \u003cspan class=\"hljs-keyword\"\u003earray\u003c/span\u003e(\n        \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Января\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e2\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Февраля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e3\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Марта\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e4\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Апреля\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e5\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Мая\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e6\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июня\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e7\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e8\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Августа\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e9\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Сентября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e10\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Октября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e11\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Ноября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e12\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Декабря\u0026#39;\u003c/span\u003e\n);\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThis creates a list of months.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e ( \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ehave_posts\u003c/span\u003e() ) :\n    \u003cspan class=\"hljs-comment\"\u003e// Start the Loop.\u003c/span\u003e\n    \u003cspan class=\"hljs-keyword\"\u003ewhile\u003c/span\u003e ( \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ehave_posts\u003c/span\u003e() ) : \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ethe_post\u003c/span\u003e();\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eToday, I have learned something about PHP. PHP has an \u003cem\u003ealternate syntax\u003c/em\u003e for blocks. Instead of \u003ccode\u003eif { statements }\u003c/code\u003e, you can do: \u003ccode\u003eif : statements endif\u003c/code\u003e. Just one more quirk of PHP to make the language more confusing.\u003c/p\u003e\n\u003cp\u003eThis block checks \u003ccode\u003ehave_posts\u003c/code\u003e in an \u003ccode\u003eif\u003c/code\u003e, and then checks it again in a \u003ccode\u003ewhile\u003c/code\u003e, meaning we don\u0026#39;t need the \u003ccode\u003eif\u003c/code\u003e at all, but so it goes. We haven\u0026#39;t gotten to the date handling yet, so let\u0026#39;s look at that.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e        \u003cspan class=\"hljs-variable\"\u003e$date\u003c/span\u003e = \u003cspan class=\"hljs-title function_ invoke__\"\u003eget_the_date\u003c/span\u003e();\n        \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e = \u003cspan class=\"hljs-title function_ invoke__\"\u003eexplode\u003c/span\u003e(\u003cspan class=\"hljs-string\"\u003e\u0026#34;.\u0026#34;\u003c/span\u003e, \u003cspan class=\"hljs-variable\"\u003e$date\u003c/span\u003e);\n\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e (\u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e]==\u003cspan class=\"hljs-string\"\u003e\u0026#39;0\u0026#39;\u003c/span\u003e)\n            \u003cspan class=\"hljs-variable\"\u003e$m\u003c/span\u003e = \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e];\n        \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e\n            \u003cspan class=\"hljs-variable\"\u003e$m\u003c/span\u003e = \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e];\n        \u003cspan class=\"hljs-meta\"\u003e?\u0026gt;\u003c/span\u003e\u0026lt;div \u003cspan class=\"hljs-class\"\u003e\u003cspan class=\"hljs-keyword\"\u003eclass\u003c/span\u003e=\u0026#34;\u003cspan class=\"hljs-title\"\u003edate\u003c/span\u003e\u0026#34;\u0026gt;\u0026lt;?\u003cspan class=\"hljs-title\"\u003ephp\u003c/span\u003e \u003cspan class=\"hljs-title\"\u003eecho\u003c/span\u003e $\u003cspan class=\"hljs-title\"\u003ed1\u003c/span\u003e[0].\u0026#34; \u0026#34;.$\u003cspan class=\"hljs-title\"\u003emonthes\u003c/span\u003e[$\u003cspan class=\"hljs-title\"\u003em\u003c/span\u003e].\u0026#34; \u0026#34;.$\u003cspan class=\"hljs-title\"\u003ed1\u003c/span\u003e[2]; ?\u0026gt;\u0026lt;/\u003cspan class=\"hljs-title\"\u003ediv\u003c/span\u003e\u0026gt;\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eWe get the date as a string, and then split it out into date parts. This is, of course, highly locale specific, but clearly they know what locale they\u0026#39;re in. Then they look at the array of date parts. The second element holds their \u0026#34;month\u0026#34; string, as two digits, so they look at the digits. If the month string starts with a \u003ccode\u003e0\u003c/code\u003e, they grab the second character and put it in \u003ccode\u003e$m\u003c/code\u003e. Otherwise, they grab the first character and put it in \u003ccode\u003e$m\u003c/code\u003e. Then they use \u003ccode\u003e$m\u003c/code\u003e to look up the \u003ccode\u003e$monthes\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eUnless there\u0026#39;s some substring weirdness going on that I don\u0026#39;t know about, this code… doesn\u0026#39;t work? Right? Since they\u0026#39;re grabbing only a single character out of \u003ccode\u003e$d1[1]\u003c/code\u003e every time, for months later in the year, \u003ccode\u003e$m\u003c/code\u003e is only ever going to hold \u003ccode\u003e1\u003c/code\u003e, and thus we only output \u003ccode\u003eЯнваря\u003c/code\u003e, meaning we get four months of January, which just seems cruel, honestly, at least in the Northern Hemisphere.\u003c/p\u003e\n\u003cp\u003eAs with all bad date handling code, this could easily be fixed by \u003cem\u003ejust using the built in\u003c/em\u003e functions, even in PHP. What I\u0026#39;m going to take away from this though is that PHP\u0026#39;s syntax lets you write in Visual Basic or Ruby if you\u0026#39;re determined enough. And you can mix and match, so enjoy a codebase that has \u003ccode\u003e:/endif\u003c/code\u003e and \u003ccode\u003e{}\u003c/code\u003e scattered throughout.\u003c/p\u003e\n\u003c!-- Easy Reader Version: PHP is awful, but also beautiful in a weird way. Like a John Waters film. Ugly, offensive, but with a core that makes you want to watch. --\u003e\n\u003cstyle\u003e.comment { border: none; }\u003c/style\u003e","BodyAndAdHtml":"\u003cp\u003e\u003cstrong\u003eVolodya\u003c/strong\u003e sends us some bad date handling code in PHP. Which, I know, you\u0026#39;re just reaching for the close tab and yawning when you hear that. You\u0026#39;ve seen it before. But bear with me, this one still has some fun bits to it.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-variable\"\u003e$monthes\u003c/span\u003e = \u003cspan class=\"hljs-keyword\"\u003earray\u003c/span\u003e(\n        \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Января\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e2\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Февраля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e3\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Марта\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e4\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Апреля\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e5\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Мая\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e6\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июня\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e7\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Июля\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e8\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Августа\u0026#39;\u003c/span\u003e,\n        \u003cspan class=\"hljs-number\"\u003e9\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Сентября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e10\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Октября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e11\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Ноября\u0026#39;\u003c/span\u003e, \u003cspan class=\"hljs-number\"\u003e12\u003c/span\u003e =\u0026gt; \u003cspan class=\"hljs-string\"\u003e\u0026#39;Декабря\u0026#39;\u003c/span\u003e\n);\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThis creates a list of months.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e ( \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ehave_posts\u003c/span\u003e() ) :\n    \u003cspan class=\"hljs-comment\"\u003e// Start the Loop.\u003c/span\u003e\n    \u003cspan class=\"hljs-keyword\"\u003ewhile\u003c/span\u003e ( \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ehave_posts\u003c/span\u003e() ) : \u003cspan class=\"hljs-variable\"\u003e$team\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003ethe_post\u003c/span\u003e();\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eToday, I have learned something about PHP. PHP has an \u003cem\u003ealternate syntax\u003c/em\u003e for blocks. Instead of \u003ccode\u003eif { statements }\u003c/code\u003e, you can do: \u003ccode\u003eif : statements endif\u003c/code\u003e. Just one more quirk of PHP to make the language more confusing.\u003c/p\u003e\n\u003cp\u003eThis block checks \u003ccode\u003ehave_posts\u003c/code\u003e in an \u003ccode\u003eif\u003c/code\u003e, and then checks it again in a \u003ccode\u003ewhile\u003c/code\u003e, meaning we don\u0026#39;t need the \u003ccode\u003eif\u003c/code\u003e at all, but so it goes. We haven\u0026#39;t gotten to the date handling yet, so let\u0026#39;s look at that.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e        \u003cspan class=\"hljs-variable\"\u003e$date\u003c/span\u003e = \u003cspan class=\"hljs-title function_ invoke__\"\u003eget_the_date\u003c/span\u003e();\n        \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e = \u003cspan class=\"hljs-title function_ invoke__\"\u003eexplode\u003c/span\u003e(\u003cspan class=\"hljs-string\"\u003e\u0026#34;.\u0026#34;\u003c/span\u003e, \u003cspan class=\"hljs-variable\"\u003e$date\u003c/span\u003e);\n\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e (\u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e]==\u003cspan class=\"hljs-string\"\u003e\u0026#39;0\u0026#39;\u003c/span\u003e)\n            \u003cspan class=\"hljs-variable\"\u003e$m\u003c/span\u003e = \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e];\n        \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e\n            \u003cspan class=\"hljs-variable\"\u003e$m\u003c/span\u003e = \u003cspan class=\"hljs-variable\"\u003e$d1\u003c/span\u003e[\u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e][\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e];\n        \u003cspan class=\"hljs-meta\"\u003e?\u0026gt;\u003c/span\u003e\u0026lt;div \u003cspan class=\"hljs-class\"\u003e\u003cspan class=\"hljs-keyword\"\u003eclass\u003c/span\u003e=\u0026#34;\u003cspan class=\"hljs-title\"\u003edate\u003c/span\u003e\u0026#34;\u0026gt;\u0026lt;?\u003cspan class=\"hljs-title\"\u003ephp\u003c/span\u003e \u003cspan class=\"hljs-title\"\u003eecho\u003c/span\u003e $\u003cspan class=\"hljs-title\"\u003ed1\u003c/span\u003e[0].\u0026#34; \u0026#34;.$\u003cspan class=\"hljs-title\"\u003emonthes\u003c/span\u003e[$\u003cspan class=\"hljs-title\"\u003em\u003c/span\u003e].\u0026#34; \u0026#34;.$\u003cspan class=\"hljs-title\"\u003ed1\u003c/span\u003e[2]; ?\u0026gt;\u0026lt;/\u003cspan class=\"hljs-title\"\u003ediv\u003c/span\u003e\u0026gt;\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eWe get the date as a string, and then split it out into date parts. This is, of course, highly locale specific, but clearly they know what locale they\u0026#39;re in. Then they look at the array of date parts. The second element holds their \u0026#34;month\u0026#34; string, as two digits, so they look at the digits. If the month string starts with a \u003ccode\u003e0\u003c/code\u003e, they grab the second character and put it in \u003ccode\u003e$m\u003c/code\u003e. Otherwise, they grab the first character and put it in \u003ccode\u003e$m\u003c/code\u003e. Then they use \u003ccode\u003e$m\u003c/code\u003e to look up the \u003ccode\u003e$monthes\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eUnless there\u0026#39;s some substring weirdness going on that I don\u0026#39;t know about, this code… doesn\u0026#39;t work? Right? Since they\u0026#39;re grabbing only a single character out of \u003ccode\u003e$d1[1]\u003c/code\u003e every time, for months later in the year, \u003ccode\u003e$m\u003c/code\u003e is only ever going to hold \u003ccode\u003e1\u003c/code\u003e, and thus we only output \u003ccode\u003eЯнваря\u003c/code\u003e, meaning we get four months of January, which just seems cruel, honestly, at least in the Northern Hemisphere.\u003c/p\u003e\n\u003cp\u003eAs with all bad date handling code, this could easily be fixed by \u003cem\u003ejust using the built in\u003c/em\u003e functions, even in PHP. What I\u0026#39;m going to take away from this though is that PHP\u0026#39;s syntax lets you write in Visual Basic or Ruby if you\u0026#39;re determined enough. And you can mix and match, so enjoy a codebase that has \u003ccode\u003e:/endif\u003c/code\u003e and \u003ccode\u003e{}\u003c/code\u003e scattered throughout.\u003c/p\u003e\n\u003c!-- Easy Reader Version: PHP is awful, but also beautiful in a weird way. Like a John Waters film. Ugly, offensive, but with a core that makes you want to watch. --\u003e\n\u003cstyle\u003e.comment { border: none; }\u003c/style\u003e\u003cdiv\u003e\n\t[Advertisement] \u003cb\u003ePlan Your .NET 9 Migration with Confidence\u003c/b\u003e\u003cbr/\u003eYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. \u003cb\u003e\u003ca href=\"https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet\u0026amp;utm_source=tdwtf-footer\"\u003eDownload Free Guide Now!\u003c/a\u003e\u003c/b\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e","Title":"Blocked the Date","RssTitle":"CodeSOD: Blocked the Date","CachedCommentCount":17,"LastCommentDate":"\/Date(1780500946673)\/","LastCommentDateDescription":"2026-06-03","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780381800000)\/","ISODate":"2026-06-02","DisplayDate":"2026-06-02","Series":{"Slug":"code-sod","Title":"CodeSOD","Description":"Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.","CssClass":"code"},"FooterAdHtml":"\u003cdiv\u003e\n\t[Advertisement] \u003cb\u003ePlan Your .NET 9 Migration with Confidence\u003c/b\u003e\u003cbr/\u003eYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. \u003cb\u003e\u003ca href=\"https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet\u0026amp;utm_source=tdwtf-footer\"\u003eDownload Free Guide Now!\u003c/a\u003e\u003c/b\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e","Url":"https://thedailywtf.com/articles/blocked-the-date","CommentsUrl":"https://thedailywtf.com/articles/comments/blocked-the-date","Slug":"blocked-the-date","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fblocked-the-date+-+Blocked+the+Date+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fblocked-the-date\u0026t=Blocked+the+Date+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Blocked%20the%20Date:%20https://thedailywtf.com/articles/blocked-the-date","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fblocked-the-date","PreviousArticleId":11193,"PreviousArticleTitle":"Let\u0027s Be Facebook!","PreviousArticleSlug":"let-s-be-facebook","PreviousArticleUrl":"//thedailywtf.com/articles/let-s-be-facebook","NextArticleId":11196,"NextArticleTitle":"Coerce the Truth Out of You","NextArticleSlug":"coerce-the-truth-out-of-you","NextArticleUrl":"//thedailywtf.com/articles/coerce-the-truth-out-of-you"},{"Id":11193,"Author":{"Name":"Ellis Morning","FirstName":"Ellis","ShortDescription":null,"DescriptionHtml":"\u003cb\u003eEllis Morning\u003c/b\u003e is a Computer Science graduate who fought in the trenches of Tech Support, occasionally crossing enemy lines into the Business Analyst and Project Management spheres of war. She\u0027s now a freelance writer and technical writer. Check out her highly-rated \u003ca href=\"https://swordandstarship.com/\" target=\"_blank\"\u003esci-fi/fantasy novels\u003c/a\u003e and find more humor, fiction, and blog posts at her \u003ca href=\"https://www.ellismorning.com\" target=\"_blank\"\u003ewebsite\u003c/a\u003e.","Slug":"ellis-morning","IsAdmin":true,"IsActive":true,"ImageUrl":"https://ellismorning.com/img/ellis2.jpeg"},"Status":"Published","SummaryHtml":"\u003cp\u003eThe real WTF is that our long-time friend and submitter \u003cb\u003eArgle\u003c/b\u003e failed to dissuade all three of his sons from pursuing IT careers of their own:\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cp\u003eBack circa 2012, my three sons all got jobs at a company that had a brilliant web project. So brilliant that it had the support of a Disney VP, the mayor of the city, and other VIPs. At one point, my sons asked to borrow money to invest in the project. They are good boys (one is now a senior developer with Proctor \u0026amp; Gamble), so I backed them.\u003c/p\u003e\n\n\u003c/blockquote\u003e","BodyHtml":"\u003cp\u003eThe real WTF is that our long-time friend and submitter \u003cb\u003eArgle\u003c/b\u003e failed to dissuade all three of his sons from pursuing IT careers of their own:\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cp\u003eBack circa 2012, my three sons all got jobs at a company that had a brilliant web project. So brilliant that it had the support of a Disney VP, the mayor of the city, and other VIPs. At one point, my sons asked to borrow money to invest in the project. They are good boys (one is now a senior developer with Proctor \u0026amp; Gamble), so I backed them.\u003c/p\u003e\n\n\u003cp\u003eA year later, the project was released late, over budget, and not fully functional.\u003c/p\u003e\n\n\u003cp style=\"float:right; padding-left:10px; padding-bottom:10px;\"\u003e\u003ca title=\"Root-ioc, CC BY-SA 4.0 \u0026lt;https://creativecommons.org/licenses/by-sa/4.0\u0026gt;, via Wikimedia Commons\" href=\"https://commons.wikimedia.org/wiki/File:Facebook_dislike.jpg\"\u003e\u003cimg itemprop=\"image\" width=\"300\" alt=\"Facebook dislike\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Facebook_dislike.jpg/330px-Facebook_dislike.jpg\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eMy boys convinced the CEO to bring me in to fix things. I fixed things. In that time, I found out they had taken bids on the project. Bids were nominally $15,000, some higher, some lower, of course. All but one group that had bid $5,000. Their plan? Hire some programmers in India for $8/hour and pocket the money without having to do work themselves. \u003c/p\u003e\n\n\u003cp\u003eCosts had shot well over $35,000 before I was brought in.\u003c/p\u003e\n\n\u003cp\u003eAfter I got the system working, I went to one of the weekly general standups for the company. The CEO walked in and said something like, \u0026#34;I just learned that Facebook was written in PHP. I think we should rewrite the whole project in PHP. That\u0026#39;s what we really need to do.\u0026#34;\u003c/p\u003e\n\n\u003cp\u003eAnd thus the decision was made.\u003c/p\u003e\n\n\u003cp\u003eA meeting was held the next day to discuss how long it would take to remake the project in PHP instead of C#. Bear in mind, a year and a half had been thrown into making the project thus far.\u003c/p\u003e\n\n\u003cp\u003eGoing around the table, everyone said between 2 and 3 weeks. There was one other programmer in the company who had exactly 2 months of work experience; he simply parroted what the others had said before him. There was also the general contractor who leased the building to the company. He was involved with the project, and was second-to-last to speak. I fully expected this contractor to have more sense. He came in at 3 to 4 weeks.\u003c/p\u003e\n\n\u003cp\u003eMy mouth dropped open.\u003c/p\u003e\n\n\u003cp\u003eIt was my turn. You know those psych tests where you get someone who acts sensibly when alone, but conforms with the rest of the crowd when there\u0026#39;s more than one? I\u0026#39;m simply \u003cem\u003enot\u003c/em\u003e that guy. I said, \u0026#34;Those are absurd estimates! This will take a minimum of 5 months before it\u0026#39;s in beta stages and not ready for public consumption for another couple more months.\u0026#34;\u003c/p\u003e\n\n\u003cp\u003eThe next day, I got a call telling me my services were no longer needed because \u0026#34;I wasn\u0026#39;t forward-thinking enough for the company.\u0026#34; \u003c/p\u003e\n\n\u003cp\u003eMy boys stayed on another year, so I got regular reports on the \u0026#34;upgrade.\u0026#34; Sure enough, just shy of 8 months later, the new system went live.\u003c/p\u003e\n\n\u003cp\u003eAs they say, the most experienced person will be the one to accurately tell everyone that it will take longer and cost more than everyone else says.\u003c/p\u003e\n\n\u003c/blockquote\u003e\n\n\u003cp\u003e\u003cb\u003eAnyone else have their own intergenerational WTFs? Please share in the comments!\u003c/b\u003e\u003c/p\u003e","BodyAndAdHtml":"\u003cp\u003eThe real WTF is that our long-time friend and submitter \u003cb\u003eArgle\u003c/b\u003e failed to dissuade all three of his sons from pursuing IT careers of their own:\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cp\u003eBack circa 2012, my three sons all got jobs at a company that had a brilliant web project. So brilliant that it had the support of a Disney VP, the mayor of the city, and other VIPs. At one point, my sons asked to borrow money to invest in the project. They are good boys (one is now a senior developer with Proctor \u0026amp; Gamble), so I backed them.\u003c/p\u003e\n\n\u003cp\u003eA year later, the project was released late, over budget, and not fully functional.\u003c/p\u003e\n\n\u003cp style=\"float:right; padding-left:10px; padding-bottom:10px;\"\u003e\u003ca title=\"Root-ioc, CC BY-SA 4.0 \u0026lt;https://creativecommons.org/licenses/by-sa/4.0\u0026gt;, via Wikimedia Commons\" href=\"https://commons.wikimedia.org/wiki/File:Facebook_dislike.jpg\"\u003e\u003cimg itemprop=\"image\" width=\"300\" alt=\"Facebook dislike\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Facebook_dislike.jpg/330px-Facebook_dislike.jpg\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eMy boys convinced the CEO to bring me in to fix things. I fixed things. In that time, I found out they had taken bids on the project. Bids were nominally $15,000, some higher, some lower, of course. All but one group that had bid $5,000. Their plan? Hire some programmers in India for $8/hour and pocket the money without having to do work themselves. \u003c/p\u003e\n\n\u003cp\u003eCosts had shot well over $35,000 before I was brought in.\u003c/p\u003e\n\n\u003cp\u003eAfter I got the system working, I went to one of the weekly general standups for the company. The CEO walked in and said something like, \u0026#34;I just learned that Facebook was written in PHP. I think we should rewrite the whole project in PHP. That\u0026#39;s what we really need to do.\u0026#34;\u003c/p\u003e\n\n\u003cp\u003eAnd thus the decision was made.\u003c/p\u003e\n\n\u003cp\u003eA meeting was held the next day to discuss how long it would take to remake the project in PHP instead of C#. Bear in mind, a year and a half had been thrown into making the project thus far.\u003c/p\u003e\n\n\u003cp\u003eGoing around the table, everyone said between 2 and 3 weeks. There was one other programmer in the company who had exactly 2 months of work experience; he simply parroted what the others had said before him. There was also the general contractor who leased the building to the company. He was involved with the project, and was second-to-last to speak. I fully expected this contractor to have more sense. He came in at 3 to 4 weeks.\u003c/p\u003e\n\n\u003cp\u003eMy mouth dropped open.\u003c/p\u003e\n\n\u003cp\u003eIt was my turn. You know those psych tests where you get someone who acts sensibly when alone, but conforms with the rest of the crowd when there\u0026#39;s more than one? I\u0026#39;m simply \u003cem\u003enot\u003c/em\u003e that guy. I said, \u0026#34;Those are absurd estimates! This will take a minimum of 5 months before it\u0026#39;s in beta stages and not ready for public consumption for another couple more months.\u0026#34;\u003c/p\u003e\n\n\u003cp\u003eThe next day, I got a call telling me my services were no longer needed because \u0026#34;I wasn\u0026#39;t forward-thinking enough for the company.\u0026#34; \u003c/p\u003e\n\n\u003cp\u003eMy boys stayed on another year, so I got regular reports on the \u0026#34;upgrade.\u0026#34; Sure enough, just shy of 8 months later, the new system went live.\u003c/p\u003e\n\n\u003cp\u003eAs they say, the most experienced person will be the one to accurately tell everyone that it will take longer and cost more than everyone else says.\u003c/p\u003e\n\n\u003c/blockquote\u003e\n\n\u003cp\u003e\u003cb\u003eAnyone else have their own intergenerational WTFs? Please share in the comments!\u003c/b\u003e\u003c/p\u003e\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/proget-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\tKeep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.\u003ca href=\"https://inedo.com/proget?utm_source=tdwtf\u0026amp;utm_medium=footer\u0026amp;utm_content=PlebsFooter\"\u003eLearn more.\u003c/a\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"Let\u0027s Be Facebook!","RssTitle":"Let\u0027s Be Facebook!","CachedCommentCount":44,"LastCommentDate":"\/Date(1780690507143)\/","LastCommentDateDescription":"2026-06-05","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780295400000)\/","ISODate":"2026-06-01","DisplayDate":"2026-06-01","Series":{"Slug":"feature-articles","Title":"Feature Articles","Description":"","CssClass":"featured"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/proget-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\tKeep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.\u003ca href=\"https://inedo.com/proget?utm_source=tdwtf\u0026amp;utm_medium=footer\u0026amp;utm_content=PlebsFooter\"\u003eLearn more.\u003c/a\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/let-s-be-facebook","CommentsUrl":"https://thedailywtf.com/articles/comments/let-s-be-facebook","Slug":"let-s-be-facebook","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2flet-s-be-facebook+-+Let%27s+Be+Facebook!+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2flet-s-be-facebook\u0026t=Let%27s+Be+Facebook!+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Let\u0027s%20Be%20Facebook!:%20https://thedailywtf.com/articles/let-s-be-facebook","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2flet-s-be-facebook","PreviousArticleId":11194,"PreviousArticleTitle":"Super SEO Strategies","PreviousArticleSlug":"super-seo-strategies","PreviousArticleUrl":"//thedailywtf.com/articles/super-seo-strategies","NextArticleId":11195,"NextArticleTitle":"Blocked the Date","NextArticleSlug":"blocked-the-date","NextArticleUrl":"//thedailywtf.com/articles/blocked-the-date"},{"Id":11194,"Author":{"Name":"Lyle Seaman","FirstName":"Lyle","ShortDescription":"networking, security infra and filesystems kernel hacker turned application programmer, SRE and engineering manager, Lyle traded tilting at windmills for viking at Vikings but couldn\u0027t catch any.","DescriptionHtml":null,"Slug":"lyle-seaman","IsAdmin":true,"IsActive":true,"ImageUrl":"/images/imageslws/viking.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003eIt\u0026#39;s ironic -- this site gets absolutely inundated with blogspam from people trying to improve their SEO ranking, and yet the only requirement to get your website linked is one dumb little typo in the right menu.\u003c/p\u003e\n\n\u003cp\u003eFaithful \n\u003cstrong\u003eMichael R.\u003c/strong\u003e is still job hunting, now even farther afield.\n\u0026#34;I shall try the gigs in United Kingsom. https://electronicmusicopenmic.com/\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003c/blockquote\u003e","BodyHtml":"\u003cp\u003eIt\u0026#39;s ironic -- this site gets absolutely inundated with blogspam from people trying to improve their SEO ranking, and yet the only requirement to get your website linked is one dumb little typo in the right menu.\u003c/p\u003e\n\n\u003cp\u003eFaithful \n\u003cstrong\u003eMichael R.\u003c/strong\u003e is still job hunting, now even farther afield.\n\u0026#34;I shall try the gigs in United Kingsom. https://electronicmusicopenmic.com/\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#43d63150fa7d48d3a7998e14e111c211\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"43d63150fa7d48d3a7998e14e111c211\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/43d63150fa7d48d3a7998e14e111c211.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eB.J.H.\u003c/strong\u003e is getting hot undeh the collah.\n\u0026#34;Weather.com is an endless source of WTF. Today the high\ntemperature will be 53F, unless you care about any hour\nafter 8:00 AM. (And why don\u0026#39;t they have enough room\nto spell out \u0026#34;hour\u0026#34;?)\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#561594f875db486085450afbb4f65a4e\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"561594f875db486085450afbb4f65a4e\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/561594f875db486085450afbb4f65a4e.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eJake W.\u003c/strong\u003e isn\u0026#39;t storming about like BJ. He just wants us to know there\u0026#39;s an opening at Durmstrang. No stress. \n\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#8eefa2a1182146b3b595a3fbbfef5012\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"8eefa2a1182146b3b595a3fbbfef5012\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/8eefa2a1182146b3b595a3fbbfef5012.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eMartin K.\u003c/strong\u003e reveals \n\u0026#34;The resignation of the Microsoft Denmark CEO broke more than news, \nit also broke the date.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#73c8b26e71ed4518bbdfeacc9850629f\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"73c8b26e71ed4518bbdfeacc9850629f\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/73c8b26e71ed4518bbdfeacc9850629f.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\u0026#34;confirmation.message.text\u0026#34; incoming from\n\u003cstrong\u003eTotty\u003c/strong\u003e\n\u0026#34;Snarky comment. Snarky comment. Snarky comment.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#d0e6feb93e324e509946643027ddbc5e\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"d0e6feb93e324e509946643027ddbc5e\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/d0e6feb93e324e509946643027ddbc5e.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n","BodyAndAdHtml":"\u003cp\u003eIt\u0026#39;s ironic -- this site gets absolutely inundated with blogspam from people trying to improve their SEO ranking, and yet the only requirement to get your website linked is one dumb little typo in the right menu.\u003c/p\u003e\n\n\u003cp\u003eFaithful \n\u003cstrong\u003eMichael R.\u003c/strong\u003e is still job hunting, now even farther afield.\n\u0026#34;I shall try the gigs in United Kingsom. https://electronicmusicopenmic.com/\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#43d63150fa7d48d3a7998e14e111c211\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"43d63150fa7d48d3a7998e14e111c211\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/43d63150fa7d48d3a7998e14e111c211.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eB.J.H.\u003c/strong\u003e is getting hot undeh the collah.\n\u0026#34;Weather.com is an endless source of WTF. Today the high\ntemperature will be 53F, unless you care about any hour\nafter 8:00 AM. (And why don\u0026#39;t they have enough room\nto spell out \u0026#34;hour\u0026#34;?)\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#561594f875db486085450afbb4f65a4e\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"561594f875db486085450afbb4f65a4e\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/561594f875db486085450afbb4f65a4e.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eJake W.\u003c/strong\u003e isn\u0026#39;t storming about like BJ. He just wants us to know there\u0026#39;s an opening at Durmstrang. No stress. \n\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#8eefa2a1182146b3b595a3fbbfef5012\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"8eefa2a1182146b3b595a3fbbfef5012\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/8eefa2a1182146b3b595a3fbbfef5012.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\n\u003cstrong\u003eMartin K.\u003c/strong\u003e reveals \n\u0026#34;The resignation of the Microsoft Denmark CEO broke more than news, \nit also broke the date.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#73c8b26e71ed4518bbdfeacc9850629f\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"73c8b26e71ed4518bbdfeacc9850629f\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/73c8b26e71ed4518bbdfeacc9850629f.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cp\u003e\u0026#34;confirmation.message.text\u0026#34; incoming from\n\u003cstrong\u003eTotty\u003c/strong\u003e\n\u0026#34;Snarky comment. Snarky comment. Snarky comment.\u0026#34;\n\u003c/p\u003e\u003cblockquote\u003e\u003cp\u003e\u003ca href=\"#d0e6feb93e324e509946643027ddbc5e\"\u003e\u003cimg itemprop=\"image\" border=\"0\" alt=\"d0e6feb93e324e509946643027ddbc5e\" src=\"https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/d0e6feb93e324e509946643027ddbc5e.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\u003cp\u003e \u003c/p\u003e\u003c/blockquote\u003e\n\n\u003cdiv\u003e\n\t[Advertisement] \u003cb\u003ePlan Your .NET 9 Migration with Confidence\u003c/b\u003e\u003cbr/\u003eYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. \u003cb\u003e\u003ca href=\"https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet\u0026amp;utm_source=tdwtf-footer\"\u003eDownload Free Guide Now!\u003c/a\u003e\u003c/b\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e","Title":"Super SEO Strategies","RssTitle":"Error\u0027d: Super SEO Strategies","CachedCommentCount":24,"LastCommentDate":"\/Date(1780323289610)\/","LastCommentDateDescription":"2026-06-01","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1780036200000)\/","ISODate":"2026-05-29","DisplayDate":"2026-05-29","Series":{"Slug":"errord","Title":"Error\u0027d","Description":"Error\u0027d features fun error messages and other visual oddities from the world of IT.","CssClass":"errord"},"FooterAdHtml":"\u003cdiv\u003e\n\t[Advertisement] \u003cb\u003ePlan Your .NET 9 Migration with Confidence\u003c/b\u003e\u003cbr/\u003eYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. \u003cb\u003e\u003ca href=\"https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet\u0026amp;utm_source=tdwtf-footer\"\u003eDownload Free Guide Now!\u003c/a\u003e\u003c/b\u003e\n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e","Url":"https://thedailywtf.com/articles/super-seo-strategies","CommentsUrl":"https://thedailywtf.com/articles/comments/super-seo-strategies","Slug":"super-seo-strategies","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fsuper-seo-strategies+-+Super+SEO+Strategies+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fsuper-seo-strategies\u0026t=Super+SEO+Strategies+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Super%20SEO%20Strategies:%20https://thedailywtf.com/articles/super-seo-strategies","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fsuper-seo-strategies","PreviousArticleId":11192,"PreviousArticleTitle":"What Condition is This","PreviousArticleSlug":"what-condition-is-this","PreviousArticleUrl":"//thedailywtf.com/articles/what-condition-is-this","NextArticleId":11193,"NextArticleTitle":"Let\u0027s Be Facebook!","NextArticleSlug":"let-s-be-facebook","NextArticleUrl":"//thedailywtf.com/articles/let-s-be-facebook"},{"Id":11192,"Author":{"Name":"Remy Porter","FirstName":"Remy","ShortDescription":"Computers were a mistake, so I accidentally became a farmer? Editor-in-Chief for TDWTF.","DescriptionHtml":"\u003cp\u003eRemy is a veteran developer who writes software for farming robots. They pick tomatoes.\u003c/p\u003e\r\n\u003cp\u003eHe\u0027s often on stage, doing improv comedy, but insists that \u003cem\u003ehe\u003c/em\u003e isn\u0027t doing comedy- it\u0027s deadly serious. You\u0027re laughing at him, not with him. That, by the way, is usually true- you\u0027re laughing at him, not with him.\u003c/p\u003e","Slug":"remy-porter","IsAdmin":true,"IsActive":true,"ImageUrl":"https://s3.amazonaws.com/remy.jetpackshark.com/remy-thumb.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003e\u003cstrong\u003eUntodesu\u003c/strong\u003e sends us this submission, with this comment:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eLiterally no idea what kind of drugs the guy was taking but nonetheless we\u0026#39;ve rewritten it to be just a two-liner\u003c/p\u003e\n\u003c/blockquote\u003e\n","BodyHtml":"\u003cp\u003e\u003cstrong\u003eUntodesu\u003c/strong\u003e sends us this submission, with this comment:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eLiterally no idea what kind of drugs the guy was taking but nonetheless we\u0026#39;ve rewritten it to be just a two-liner\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eWell, that doesn\u0026#39;t tell us a lot about what to expect from the code, but let\u0026#39;s take a look.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-cpp\"\u003e\u003cspan class=\"hljs-function\"\u003eQStringList \u003cspan class=\"hljs-title\"\u003eTableViewAssembly::parametersFilter\u003c/span\u003e\u003cspan class=\"hljs-params\"\u003e(ProbePart::Type type, \u003cspan class=\"hljs-type\"\u003eint\u003c/span\u003e pos, QList\u0026lt;ProbePart\u0026gt; probeDesign)\u003c/span\u003e \u003c/span\u003e{\n    QString to, from;\n\n    \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == \u003cspan class=\"hljs-number\"\u003e-1\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() == \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e) {\n            to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n            from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;AutoJoint\u0026#34;\u003c/span\u003e;\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();;\n            from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;AutoJoint\u0026#34;\u003c/span\u003e;\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() == \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n            \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e() == ProbePart::Type::Stylus) {\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n                from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n            } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n                to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n                from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n            }\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos + \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() - \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e() == ProbePart::Type::Stylus) {\n            \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() \u0026lt;= \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n                from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n                from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos - \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            }\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n            to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n        from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n        to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos + \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n    }\n\n    \u003cspan class=\"hljs-keyword\"\u003ereturn\u003c/span\u003e { to, from };\n}\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003ccode\u003eQStringList\u003c/code\u003e and\u003ccode\u003eQList\u003c/code\u003e tell me that this is a Qt-based application. The goal of this function seems to be to take some inputs about a \u0026#34;probe part\u0026#34; and construct a pair of strings. Let\u0026#39;s trace through it.\u003c/p\u003e\n\u003cp\u003eLet\u0026#39;s just walk through the conditions, quickly, without worrying too much about the inside. We look at \u003ccode\u003epos\u003c/code\u003e, and check for three cases: either \u003ccode\u003epos\u003c/code\u003e is \u003ccode\u003e-1\u003c/code\u003e, \u003ccode\u003e0\u003c/code\u003e, or \u003ccode\u003eprobeDesign.length() - 1\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eInside each of those branches, we \u003cem\u003ealso\u003c/em\u003e check the length of the list, testing if it contains no elements, exactly one elemnet, or more than one element. We \u003cem\u003ealso\u003c/em\u003e check if the part in question is a stylus.\u003c/p\u003e\n\u003cp\u003eWith that in mind, let\u0026#39;s see if we can summarize the conditions here. If \u003ccode\u003epos == -1\u003c/code\u003e, we do some automatic stuff, using the first element in the list if there is one. If \u003ccode\u003epos == 0\u003c/code\u003e \u003cem\u003eand\u003c/em\u003e there\u0026#39;s exactly one element in the list, we grab the first element and link it to \u003ccode\u003e*\u003c/code\u003e (the to/from order depends on the stylus question). If there\u0026#39;s \u003cem\u003emore\u003c/em\u003e that one element in the list, we pair the current \u003ccode\u003epos\u003c/code\u003e with \u003ccode\u003epos+1\u003c/code\u003e; notably, in this branch, \u003ccode\u003epos\u003c/code\u003e is definitely zero. If \u003ccode\u003epos\u003c/code\u003e is the last element in the list, we follow the same logic, but pair with \u003ccode\u003epos-1\u003c/code\u003e, with a side branch for checking against the length of the list.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eIt\u0026#39;s all bounds checking\u003c/em\u003e. That\u0026#39;s all this code is. Bounds checking that\u0026#39;s gotten out of hand. The main branch here is actually the final \u003ccode\u003eelse\u003c/code\u003e: that\u0026#39;s where most of the code is going to pass through. All the other branches are just handling edge cases.  \u003cem\u003eLiteral\u003c/em\u003e edge cases, as in \u0026#34;the edge of the list\u0026#34;.\u003c/p\u003e\n\u003cp\u003eUntodesu didn\u0026#39;t supply the two line version, but based on the fact such a version exists, I also suspect that \u003cem\u003emany of these branches weren\u0026#39;t actually used\u003c/em\u003e. Or, at least, based on the actual business rules, could be combined.\u003c/p\u003e\n\u003c!-- Easy Reader Version: Conditionals considered harmful --\u003e","BodyAndAdHtml":"\u003cp\u003e\u003cstrong\u003eUntodesu\u003c/strong\u003e sends us this submission, with this comment:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eLiterally no idea what kind of drugs the guy was taking but nonetheless we\u0026#39;ve rewritten it to be just a two-liner\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eWell, that doesn\u0026#39;t tell us a lot about what to expect from the code, but let\u0026#39;s take a look.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-cpp\"\u003e\u003cspan class=\"hljs-function\"\u003eQStringList \u003cspan class=\"hljs-title\"\u003eTableViewAssembly::parametersFilter\u003c/span\u003e\u003cspan class=\"hljs-params\"\u003e(ProbePart::Type type, \u003cspan class=\"hljs-type\"\u003eint\u003c/span\u003e pos, QList\u0026lt;ProbePart\u0026gt; probeDesign)\u003c/span\u003e \u003c/span\u003e{\n    QString to, from;\n\n    \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == \u003cspan class=\"hljs-number\"\u003e-1\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() == \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e) {\n            to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n            from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;AutoJoint\u0026#34;\u003c/span\u003e;\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(\u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();;\n            from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;AutoJoint\u0026#34;\u003c/span\u003e;\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() == \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n            \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e() == ProbePart::Type::Stylus) {\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n                from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n            } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n                to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n                from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n            }\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos + \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(pos == probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() - \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n        \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etype\u003c/span\u003e() == ProbePart::Type::Stylus) {\n            \u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(probeDesign.\u003cspan class=\"hljs-built_in\"\u003elength\u003c/span\u003e() \u0026lt;= \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e) {\n                from = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n                from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos - \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n                to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n            }\n        } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n            from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n            to = \u003cspan class=\"hljs-string\"\u003e\u0026#34;*\u0026#34;\u003c/span\u003e;\n        }\n    } \u003cspan class=\"hljs-keyword\"\u003eelse\u003c/span\u003e {\n        from = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos).\u003cspan class=\"hljs-built_in\"\u003etoMounting\u003c/span\u003e();\n        to = probeDesign.\u003cspan class=\"hljs-built_in\"\u003eat\u003c/span\u003e(pos + \u003cspan class=\"hljs-number\"\u003e1\u003c/span\u003e).\u003cspan class=\"hljs-built_in\"\u003efromMounting\u003c/span\u003e();\n    }\n\n    \u003cspan class=\"hljs-keyword\"\u003ereturn\u003c/span\u003e { to, from };\n}\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u003ccode\u003eQStringList\u003c/code\u003e and\u003ccode\u003eQList\u003c/code\u003e tell me that this is a Qt-based application. The goal of this function seems to be to take some inputs about a \u0026#34;probe part\u0026#34; and construct a pair of strings. Let\u0026#39;s trace through it.\u003c/p\u003e\n\u003cp\u003eLet\u0026#39;s just walk through the conditions, quickly, without worrying too much about the inside. We look at \u003ccode\u003epos\u003c/code\u003e, and check for three cases: either \u003ccode\u003epos\u003c/code\u003e is \u003ccode\u003e-1\u003c/code\u003e, \u003ccode\u003e0\u003c/code\u003e, or \u003ccode\u003eprobeDesign.length() - 1\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eInside each of those branches, we \u003cem\u003ealso\u003c/em\u003e check the length of the list, testing if it contains no elements, exactly one elemnet, or more than one element. We \u003cem\u003ealso\u003c/em\u003e check if the part in question is a stylus.\u003c/p\u003e\n\u003cp\u003eWith that in mind, let\u0026#39;s see if we can summarize the conditions here. If \u003ccode\u003epos == -1\u003c/code\u003e, we do some automatic stuff, using the first element in the list if there is one. If \u003ccode\u003epos == 0\u003c/code\u003e \u003cem\u003eand\u003c/em\u003e there\u0026#39;s exactly one element in the list, we grab the first element and link it to \u003ccode\u003e*\u003c/code\u003e (the to/from order depends on the stylus question). If there\u0026#39;s \u003cem\u003emore\u003c/em\u003e that one element in the list, we pair the current \u003ccode\u003epos\u003c/code\u003e with \u003ccode\u003epos+1\u003c/code\u003e; notably, in this branch, \u003ccode\u003epos\u003c/code\u003e is definitely zero. If \u003ccode\u003epos\u003c/code\u003e is the last element in the list, we follow the same logic, but pair with \u003ccode\u003epos-1\u003c/code\u003e, with a side branch for checking against the length of the list.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eIt\u0026#39;s all bounds checking\u003c/em\u003e. That\u0026#39;s all this code is. Bounds checking that\u0026#39;s gotten out of hand. The main branch here is actually the final \u003ccode\u003eelse\u003c/code\u003e: that\u0026#39;s where most of the code is going to pass through. All the other branches are just handling edge cases.  \u003cem\u003eLiteral\u003c/em\u003e edge cases, as in \u0026#34;the edge of the list\u0026#34;.\u003c/p\u003e\n\u003cp\u003eUntodesu didn\u0026#39;t supply the two line version, but based on the fact such a version exists, I also suspect that \u003cem\u003emany of these branches weren\u0026#39;t actually used\u003c/em\u003e. Or, at least, based on the actual business rules, could be combined.\u003c/p\u003e\n\u003c!-- Easy Reader Version: Conditionals considered harmful --\u003e\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"What Condition is This","RssTitle":"CodeSOD: What Condition is This","CachedCommentCount":13,"LastCommentDate":"\/Date(1780079872227)\/","LastCommentDateDescription":"2026-05-29","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1779949800000)\/","ISODate":"2026-05-28","DisplayDate":"2026-05-28","Series":{"Slug":"code-sod","Title":"CodeSOD","Description":"Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.","CssClass":"code"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/what-condition-is-this","CommentsUrl":"https://thedailywtf.com/articles/comments/what-condition-is-this","Slug":"what-condition-is-this","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fwhat-condition-is-this+-+What+Condition+is+This+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fwhat-condition-is-this\u0026t=What+Condition+is+This+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=What%20Condition%20is%20This:%20https://thedailywtf.com/articles/what-condition-is-this","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fwhat-condition-is-this","PreviousArticleId":11191,"PreviousArticleTitle":"Are There Files Yet?","PreviousArticleSlug":"are-there-files-yet","PreviousArticleUrl":"//thedailywtf.com/articles/are-there-files-yet","NextArticleId":11194,"NextArticleTitle":"Super SEO Strategies","NextArticleSlug":"super-seo-strategies","NextArticleUrl":"//thedailywtf.com/articles/super-seo-strategies"},{"Id":11191,"Author":{"Name":"Remy Porter","FirstName":"Remy","ShortDescription":"Computers were a mistake, so I accidentally became a farmer? Editor-in-Chief for TDWTF.","DescriptionHtml":"\u003cp\u003eRemy is a veteran developer who writes software for farming robots. They pick tomatoes.\u003c/p\u003e\r\n\u003cp\u003eHe\u0027s often on stage, doing improv comedy, but insists that \u003cem\u003ehe\u003c/em\u003e isn\u0027t doing comedy- it\u0027s deadly serious. You\u0027re laughing at him, not with him. That, by the way, is usually true- you\u0027re laughing at him, not with him.\u003c/p\u003e","Slug":"remy-porter","IsAdmin":true,"IsActive":true,"ImageUrl":"https://s3.amazonaws.com/remy.jetpackshark.com/remy-thumb.jpg"},"Status":"Published","SummaryHtml":"\u003cp\u003eAre there any files to send? That\u0026#39;s the question that \u003cstrong\u003eChris C\u003c/strong\u003e\u0026#39;s predecessor had. So they asked it. Again. And again. And \u003cem\u003eagain\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eChris writes:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e","BodyHtml":"\u003cp\u003eAre there any files to send? That\u0026#39;s the question that \u003cstrong\u003eChris C\u003c/strong\u003e\u0026#39;s predecessor had. So they asked it. Again. And again. And \u003cem\u003eagain\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eChris writes:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eI\u0026#39;m occasionally called upon to troubleshoot an ecommerce application that was built in the PHP 5.x days and has been running largely untroubled by maintenance or modernity (aside from the backported security patches to its binaries) ever since.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(\u003cspan class=\"hljs-title function_ invoke__\"\u003esizeof\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e) \u0026gt; \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e){\n\t\t\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(\u003cspan class=\"hljs-title function_ invoke__\"\u003esizeof\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e) \u0026gt; \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e){\n\t\t\t\t\u003cspan class=\"hljs-keyword\"\u003eforeach\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eas\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003e$file\u003c/span\u003e){\n\t\t\t\t\t\t\u003cspan class=\"hljs-variable\"\u003e$mime\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003eaddAttachment\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$file\u003c/span\u003e);\n\t\t}\n\t\t}\n}\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eIndentation as per the original.\u003c/p\u003e\n\u003cp\u003eIf the files array contains items, then if the files array contains items, then we iterate across the files array, which hopefully contains items, and add them as an attachment to an email.\u003c/p\u003e\n\u003cp\u003eI feel like the way this got indented, the developer responsible knew, deep down, that this was wrong. They lacked the reading comprehension to understand why, but deep down in their spleen, something was screaming at them. And thus those stacked curly brackets at the end there.\u003c/p\u003e\n\u003cp\u003eOf course, none of the conditionals are needed: a foreach on an empty object just does nothing.\u003c/p\u003e\n\u003c!-- Easy Reader Version: Probably a copy/paste error, but like, *that\u0027s why you read your code*. This code predates LLMs, but I have also seen LLMs make this kind of mistake- my dabbling with them, they like to try and solve compile errors by opening and closing namespaces at random, and get into a loop of \"add a namespace, remove a namespace, add a namespace…\" --\u003e","BodyAndAdHtml":"\u003cp\u003eAre there any files to send? That\u0026#39;s the question that \u003cstrong\u003eChris C\u003c/strong\u003e\u0026#39;s predecessor had. So they asked it. Again. And again. And \u003cem\u003eagain\u003c/em\u003e.\u003c/p\u003e\n\u003cp\u003eChris writes:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eI\u0026#39;m occasionally called upon to troubleshoot an ecommerce application that was built in the PHP 5.x days and has been running largely untroubled by maintenance or modernity (aside from the backported security patches to its binaries) ever since.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cpre\u003e\u003ccode class=\"language-php\"\u003e\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(\u003cspan class=\"hljs-title function_ invoke__\"\u003esizeof\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e) \u0026gt; \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e){\n\t\t\u003cspan class=\"hljs-keyword\"\u003eif\u003c/span\u003e(\u003cspan class=\"hljs-title function_ invoke__\"\u003esizeof\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e) \u0026gt; \u003cspan class=\"hljs-number\"\u003e0\u003c/span\u003e){\n\t\t\t\t\u003cspan class=\"hljs-keyword\"\u003eforeach\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$files\u003c/span\u003e \u003cspan class=\"hljs-keyword\"\u003eas\u003c/span\u003e \u003cspan class=\"hljs-variable\"\u003e$file\u003c/span\u003e){\n\t\t\t\t\t\t\u003cspan class=\"hljs-variable\"\u003e$mime\u003c/span\u003e-\u0026gt;\u003cspan class=\"hljs-title function_ invoke__\"\u003eaddAttachment\u003c/span\u003e(\u003cspan class=\"hljs-variable\"\u003e$file\u003c/span\u003e);\n\t\t}\n\t\t}\n}\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eIndentation as per the original.\u003c/p\u003e\n\u003cp\u003eIf the files array contains items, then if the files array contains items, then we iterate across the files array, which hopefully contains items, and add them as an attachment to an email.\u003c/p\u003e\n\u003cp\u003eI feel like the way this got indented, the developer responsible knew, deep down, that this was wrong. They lacked the reading comprehension to understand why, but deep down in their spleen, something was screaming at them. And thus those stacked curly brackets at the end there.\u003c/p\u003e\n\u003cp\u003eOf course, none of the conditionals are needed: a foreach on an empty object just does nothing.\u003c/p\u003e\n\u003c!-- Easy Reader Version: Probably a copy/paste error, but like, *that\u0027s why you read your code*. This code predates LLMs, but I have also seen LLMs make this kind of mistake- my dabbling with them, they like to try and solve compile errors by opening and closing namespaces at random, and get into a loop of \"add a namespace, remove a namespace, add a namespace…\" --\u003e\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Title":"Are There Files Yet?","RssTitle":"CodeSOD: Are There Files Yet?","CachedCommentCount":16,"LastCommentDate":"\/Date(1779958252183)\/","LastCommentDateDescription":"2026-05-28","DiscourseTopicId":null,"DiscourseTopicOpened":false,"PublishedDate":"\/Date(1779863400000)\/","ISODate":"2026-05-27","DisplayDate":"2026-05-27","Series":{"Slug":"code-sod","Title":"CodeSOD","Description":"Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.","CssClass":"code"},"FooterAdHtml":"\u003cdiv\u003e\n\t\u003cimg src=\"https://thedailywtf.com/images/inedo/buildmaster-icon.png\" style=\"display:block; float: left; margin: 0 10px 10px 0;\"/\u003e [Advertisement] \n\t\u003ca href=\"https://inedo.com/BuildMaster?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eUtilize BuildMaster\u003c/a\u003e to release your software with confidence, at the pace your business demands. \u003ca href=\"https://inedo.com/BuildMaster/download?utm_source=tdwtf\u0026amp;utm_medium=footerad\u0026amp;utm_term=2018\u0026amp;utm_content=Confidence\u0026amp;utm_campaign=Buildmaster_Footer\"\u003eDownload\u003c/a\u003e today!  \n\u003c/div\u003e\n\u003cdiv style=\"clear: left;\"\u003e \u003c/div\u003e\n","Url":"https://thedailywtf.com/articles/are-there-files-yet","CommentsUrl":"https://thedailywtf.com/articles/comments/are-there-files-yet","Slug":"are-there-files-yet","TwitterUrl":"//www.twitter.com/home?status=https%3a%2f%2fthedailywtf.com%2farticles%2fare-there-files-yet+-+Are+There+Files+Yet%3f+-+The+Daily+WTF","FacebookUrl":"//www.facebook.com/sharer.php?u=https%3a%2f%2fthedailywtf.com%2farticles%2fare-there-files-yet\u0026t=Are+There+Files+Yet%3f+-+The+Daily+WTF","EmailUrl":"mailto:%20?subject=Check%20out%20this%20article%20on%20The%20Daily%20WTF...\u0026body=Are%20There%20Files%20Yet?: https://thedailywtf.com/articles/are-there-files-yet","GooglePlusUrl":"//plus.google.com/share?url=https%3a%2f%2fthedailywtf.com%2farticles%2fare-there-files-yet","PreviousArticleId":11190,"PreviousArticleTitle":"Whales Ahoy!","PreviousArticleSlug":"whales-ahoy","PreviousArticleUrl":"//thedailywtf.com/articles/whales-ahoy","NextArticleId":11192,"NextArticleTitle":"What Condition is This","NextArticleSlug":"what-condition-is-this","NextArticleUrl":"//thedailywtf.com/articles/what-condition-is-this"}]