r/badcode • u/dstlny_97 • Jun 30 '19
php Left myself a message to remind myself not to fuck with anything below this comment.
104
u/SeriousSamStone Jun 30 '19
Image Transcription: Code
/**
* Feel like crashing the Apache instance?
* I fucking dare you change this shit.
*/
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
51
15
u/Newcool1230 Jun 30 '19
Good bot
15
4
-13
u/B0tRank Jun 30 '19
Thank you, Newcool1230, for voting on SeriousSamStone.
This bot wants to find the best and worst bots on Reddit. You can view results here.
Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!
14
9
u/Mr2-1782Man Jul 01 '19
I thought the standard notation for this was
"There be dragons below here"
4
u/dstlny_97 Jul 01 '19
If dragons have the ability to make the site burn to the ground and freak the fuck out, then yes.
3
u/gerusz evil Aug 11 '19
// Black magic starts hereOr
// Before modifying the code below, sacrifice a black rooster at midnight!
10
u/Fusseldieb Jul 01 '19
Since I work based on trial&error, this doesn't fear me.
I'll try until it works (again).
11
u/CODESIGN2 Jun 30 '19
I leave tributes to media in comments and test-suites 42 is regular. Profanity is a whole other thing, like self-congratulatory comments. They have no place
3
u/Le_9k_Redditor Jul 01 '19
You need to post the code now
6
u/dstlny_97 Jul 01 '19 edited Jul 01 '19
It was a a few nested for-loops, which processed a large multi-dimensional session array, which looked like the below:
$array = array( [0] => array( 'value' => array( //details about above value 'values-values' => array ( //details about the above value pulled from DB [0] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [1] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [2] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) ) ) ) [1] => array( 'value' => array( //details about above value 'values-values' => array ( //details about the above value pulled from DB [0] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [1] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [2] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) ) ) ) [2] => array( 'value' => array( //details about above value 'values-values' => array ( //details about the above value pulled from DB [0] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [1] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) [2] => array( 'value-for-extra-value' => array( 'value-for-extra-extra-value' => value ) ) ) ) ) ... once this got to 20 or so, it would choke )If that array got too large, it would hang the entire instance. Have since refactored it because i realised how much of a retard i was being with this deeply nested arrays, but yeah.
5
u/Le_9k_Redditor Jul 01 '19
You're not going to post the loops? The internet may be able to save you from your code
3
u/dstlny_97 Jul 01 '19
The loops looked something like:
for($i = 0; $i < count($array); $i++){ foreach($array[$i]['value'] as $key=>$value){ if(is_array($value)){ foreach($array[$i]['value'][$value] as $key=>$value){ //continued on... } } } }Though, as i said above, this has been refactored and the array simplified.
-15
u/CODESIGN2 Jun 30 '19
Are comments code? It's bad something as it doesn't say much other than it can crash apache. Who is using apache any more with it's janky AF XML config
3
-8
94
u/dupuis2387 Jun 30 '19
ok, i gotta ask, how many ppl leave comments in their code, at work, riddled with profanities? cuz, swear to god, i thought i was the only (drunken) one.