PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Path to /tmp is hardcoded ?

  1. Let me start off by saying, this is way over my head (I am a designer not a programmer, however I am learning more about the programming end), however, my host is saying that I would need to change code and that it seems to be a bug in gravity forms....

    Apparently POST wordpress/gravity forms install, my host moved the the /tmp file to my own root directory.  In other words, site was working fine and without notice they moved this directory or what ever they did.

    I then had no issues with gravity forms, my issue was being able to upload images via wordpress.  However after they "fixed" the php.ini file it still did not correct the issue and this is what they sent me.

    Here is what he host sent me, some of the listed items are wordpress:
    "The wordpress modules you are using have some bad code in them:

    See how the path to /tmp is hardcoded ?

    Instead the module should get the value from php for upload_tmp_dir and use that.

    rg /tmp *
    wp-content/plugins/gravityforms/forms_model.php: $temp_filepath = self::get_upload_path($form_id) . "/tmp/" . $file_info["temp_filename"];

    wp-content/plugins/gravityforms/forms_model.php: $source = self::get_upload_path($form_id) . "/tmp/" . $tempfile_info["temp_filename"];

    wp-content/plugins/gravityforms/form_display.php: $target_path = RGFormsModel::get_upload_path($form["id"]) . "/tmp/";
    wp-includes/Text/Diff.php: $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',

    wp-includes/functions.php: * Function's preference is to WP_CONTENT_DIR followed by the return value of sys_get_temp_dir(), before finally defaulting to /tmp/

    wp-includes/functions.php: $temp = '/tmp/';

    wp-includes/class-snoopy.php: var $temp_dir = "/tmp"; // temporary directory that the webserver
    wp-includes/js/tinymce/plugins/spellchecker/config.php: $config['PSpellShell.tmp'] = '/tmp'; 

    So, they basically said I had to fix this code and then deliver it to them!  So I am not at all sure what I am suppose to do, but wanted to find out, is this bad code, and if I do fix the code, how do I fix the code, and will it cause issues when a new version is released.  Like I said this is a bit over my head!

    Thanks in advance for your help!

    Posted 13 years ago on Monday January 23, 2012 | Permalink
  2. Gravity Forms does not hardcode any paths. The tmp folder location isn't hardcoded by Gravity Forms and is dependent upon the location of your WordPress uploads folder.

    For example this line:

    self::get_upload_path($form_id) . "/tmp/" .

    It's using the core WordPress function get_upload_path and then appending the tmp folder name as part of the path because Gravity Forms creates a folder called "tmp" within your WordPress upload folder.

    Gravity Forms uses built in WordPress functions related to getting proper paths such as get_upload_path whenever it interacts with the file system.

    There is nothing in that code that needs to be corrected. In fact, some of the code they included examples for AREN'T Gravity Forms code it's core WordPress code.

    wp-includes/js/tinymce/plugins/spellchecker/config.php is core WordPress
    wp-includes/functions.php is core WordPress
    wp-includes/class-snoopy.php is core WordPress

    Your host can't just move /tmp/ folders around. WordPress wants the /tmp/ folder to be located in the wp-content/uploads folder wherever that may be. You can move your wp-content folder, but you need to know what you are doing so and based on this i'd say your web host has no clue what it is doing.

    Your host is incorrect and their response should certainly give you pause and rethink who you do business with as far as web hosting goes.

    Posted 13 years ago on Friday February 3, 2012 | Permalink

This topic has been resolved and has been closed to new replies.