Maciej, a freelance developer, took on a long-neglected PHP project to implement missing features, including HTTP requests to external services at intervals. Examining the codebase, he found a recurring pattern: curl initialization followed by multiple option-setting calls and curl_exec, with the result stored in variable $s.
The problematic code appeared copy-pasted across many locations:
$ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie ); curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie ); curl_setopt( $ch, CURLOPT_COOKIE, $cookie); // ... more options ... curl_setopt( $ch, CURLOPT_TIMEOUT, $interval ); $s = curl_exec( $ch ); curl_close( $ch );
The requests executed successfully, but the result was never consumed. No subsequent code processed $s or acted on the response. The presence of CURLOPT_TIMEOUT assigned the value of $interval suggests the original developer may have confused cURL's timeout parameter with automatic request rescheduling—a misuse that wouldn't function as intended regardless. Despite the project containing "far worse spaghetti code," this gap epitomized the incomplete work: functional HTTP calls achieving nothing.
Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Nothing arrived? Check your spam folder — and mark the mail as "Not spam" so it lands in your inbox next time.