@@ -259,8 +259,8 @@ function create_captcha($data)
259259 // -----------------------------------
260260 $ length = strlen ($ word );
261261 $ angle = ($ length >= 6 ) ? mt_rand (-($ length - 6 ), ($ length - 6 )) : 0 ;
262- $ x_axis = mt_rand (6 , (360 / $ length )- 16 );
263- $ y_axis = ($ angle >= 0 ) ? mt_rand ($ img_height , $ img_width ) : mt_rand (6 , $ img_height );
262+ $ x_axis = mt_rand (6 , (int ) (( 360 / $ length ) - 16 ) );
263+ $ y_axis = ($ angle >= 0 ) ? mt_rand (( int ) $ img_height , ( int ) $ img_width ) : mt_rand (6 , ( int ) $ img_height );
264264
265265 // Create image
266266 // PHP.net recommends imagecreatetruecolor(), but it isn't always available
@@ -315,27 +315,27 @@ function create_captcha($data)
315315 if ($ use_font === FALSE )
316316 {
317317 ($ font_size > 5 ) && $ font_size = 5 ;
318- $ x = mt_rand (0 , $ img_width / ($ length / 3 ));
318+ $ x = mt_rand (0 , ( int ) ( $ img_width / ($ length / 3 ) ));
319319 $ y = 0 ;
320320 }
321321 else
322322 {
323323 ($ font_size > 30 ) && $ font_size = 30 ;
324- $ x = mt_rand (0 , $ img_width / ($ length / 1.5 ));
324+ $ x = mt_rand (0 , ( int ) ( $ img_width / ($ length / 1.5 ) ));
325325 $ y = $ font_size + 2 ;
326326 }
327327
328328 for ($ i = 0 ; $ i < $ length ; $ i ++)
329329 {
330330 if ($ use_font === FALSE )
331331 {
332- $ y = mt_rand (0 , $ img_height / 2 );
332+ $ y = mt_rand (0 , ( int ) ( $ img_height / 2 ) );
333333 imagestring ($ im , $ font_size , $ x , $ y , $ word [$ i ], $ colors ['text ' ]);
334334 $ x += ($ font_size * 2 );
335335 }
336336 else
337337 {
338- $ y = mt_rand ($ img_height / 2 , $ img_height - 3 );
338+ $ y = mt_rand (( int ) ( $ img_height / 2 ), ( int ) ( $ img_height - 3 ) );
339339 imagettftext ($ im , $ font_size , $ angle , $ x , $ y , $ colors ['text ' ], $ font_path , $ word [$ i ]);
340340 $ x += $ font_size ;
341341 }
0 commit comments