Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Strange parse error in Form_validation library : unexpected T_STRING eval()'d code (/showthread.php?tid=16039) Pages:
1
2
|
Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]Isuka[/eluser] Hi there, My client got a strange error when he's using the application I build for him. I don't understand the error and when I try everything is fine for me so I can't reproduce the bug. Here is the error message : Code: Parse error: syntax error, unexpected T_STRING in /var/www/coursdiderot/inscription/system/libraries/Form_validation.php(457) : eval()'d code on line 1 So the error is related with the Form_validation library but I don't know what to do with that. The website run under CodeIgniter 1.7. I didn't upgrade the application to the new CI version yet so maybe this bug is fixed in the 1.7.1 but I'd like to be sure. Thanks for any advice Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]pistolPete[/eluser] Which php version is your client using? I can't find an eval() in the Form validation class of CI 1.7.1 Could you post some more code? Just a guess: Are you using CI's feature "Rewrite PHP Short Tags" ? Code: $config['rewrite_short_tags'] = ? Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]xwero[/eluser] It seems they fixed it in the latest version but in 1.7 you find following line at line 450 Code: $post .= ' = $array;'; Which should be Code: $post .= " = $array;"; /* or */ $post .= ' = '.$array.';'; Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]Isuka[/eluser] Thanks for helping. The PHP version of the server is 5.2.8. I don't use the Rewrite PHP Short Tags feature, I always use "<?php" tag. Here is the function with the eval() call, line 457 of my Form_validation library (the 1.7 one): Code: // -------------------------------------------------------------------- Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]Isuka[/eluser] [quote author="xwero" date="1235415618"]It seems they fixed it in the latest version but in the version with the eval function you find following line at 450 Code: $post .= ' = $array;'; Which should be Code: $post .= " = $array;"; /* or */ $post .= ' = '.$array.';'; Thanks xwero for this EDIT : I tried with both Code: $post .= " = $array;"; /* and */ $post .= ' = '.$array.';'; Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]xwero[/eluser] You can replace the whole function if you want Code: function _reset_post_array() Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]TheFuzzy0ne[/eluser] If you create this file, it should fix the issue for you. ./system/application/libraries/MY_Form_validation Code: class MY_Form_validation extends CI_Form_validation { EDIT 1: I think xwero's function is missing the final eval(); EDIT 2: Hmmm, his function is quite different. Me = confused... Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]Isuka[/eluser] I have changed the _reset_post_array() function with xwero's one. I don't see any error. I call my client to see if it's ok with him. Thanks for your help guys Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]xwero[/eluser] The code Isuka provided is the code from CI 1.7, the code i provided is from CI 1.7.1. In the 1.7.1 version the code changes the post global by using a reference where in the 1.7 function it's done by using eval. Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - El Forum - 02-23-2009 [eluser]TheFuzzy0ne[/eluser] Aaah. That makes sense now. Thanks for clearing that up. |