potential Issue with PHP memory exhaustion…..
-
Hi We had issues with php memory exhaustion. After enabling debug mode in WP we observed the following:
[03-Aug-2017 14:10:34 UTC] PHP Notice: Uninitialized string offset: 62 in /var/vhosts/rsj/wp-content/plugins/ultimate-faqs/Shortcodes/DisplayFAQs.php on line 498I think the culprit is the rand function parameters……Code looks like:
function EWD_UFAQ_Rand_Chars($CharLength = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randstring = ''; for ($i = 0; $i < $CharLength; $i++) { $randstring .= $characters[rand(0, strlen($characters))]; } return $randstring; }But I think it’s supposed to be like:
function EWD_UFAQ_Rand_Chars($CharLength = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randstring = ''; for ($i = 0; $i < $CharLength; $i++) { $randstring .= $characters[rand(0, strlen($characters) - 1)]; } return $randstring; }No? rand(0,62) would create a out of bound error (above) if the random number generated is 62 (since the charater array index is 0-61)….
I also think there might be issues with spaces in Faq category Names. We had a Name with a space in it and the shortcode for that category refused to work (we have 4 categories…..3 have no spaces and work properly…..1 had spaces and it didn’t work).
The topic ‘potential Issue with PHP memory exhaustion…..’ is closed to new replies.