I upgraded my system a few days ago from drupal core 7.10 to 7.12. After the upgrade, I got two errors:

Warning: file_put_contents(temporary://filecKUocB) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1904 of /home/public_html/includes/file.inc).

And

Notice: Trying to get property of non-object in gmap_regenerate_markers() (line 555 of /home/infocomm/public_html/sites/all/modules/gmap/gmap.module).

The only apparent problem I found on my site after this was that a custom content type I have used successfully for some time (public event) no longer allows me to create new pieces of content. When I click "create public event", I am taken to the correct URL for creating that content, but all I see is a blank screen and no favicon (which appears with other content creation) in the address bar. This does not appear to generate any error messages. Certainly not onscreen and I do not see this action generating any log messages.

Among the fields for the module are date (which is linked to calendar) and location. However, I have another content type (course event) with identical fields, the only difference being that this is a group content type, and that one is working normally.

In trying to sort this out, I removed Gmap modules. This made the initial errors noted above stop occurring (and of course deleted the associated fields), but the public event content type still will not allow content creation and presents a blank page upon attempting to create new content.

I have searched drupal.org for clues to try to figure out what the problem is with my public event content type, but to no avail. I am looking for suggestions on how to troubleshoot this problem to (hopefully) restore the content type to enable creation of new content without deleting existing content. I would appreciate any suggestions.

Thank you.

Comments

mototribe’s picture

Title: After core upgrade 7.10 to 7.12, content type cannot create new content » error when temporary directory is invalid
Category: support » bug

I had a similar error after uploading my local site to my dev site (on Pantheon).

Warning: file_put_contents(temporary://filerpztfq): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1904 of /srv/bindings/31e75de31e214292a19eca3a06b11c03/code/includes/file.inc).
The file could not be created.

In addition my admin menu bar wouldn't show (css was shot) so I had a hard time trying to access admin pages.
I had to call the admin pages directly in the URL.

The culprit in my case turned out to be an incorrect temp directly. Once I changed it to /tmp (and cleared the cache) everything worked fine.

I would say this is a bug. There could be better error handling/messaging if there is an invalid temp directory.

femrich’s picture

There seems to be a problem with new drupal versions not automatically clearing cache upon upgrade. At least, I had a similar (though not identical) issue with a previous upgrade, and a comment from webchick, if I recall correctly, led me to clear cache manually and cleared the problem. I did the same in this case, and the problem seemed to go away...

Orkut Murat Yılmaz’s picture

as told on #1, I have done the things I listed below,

- create a tmp directory under the files directory
- configure file system (admin/config/media/file-system)
- flush all cache.

voila! now it's working properly. thank you @mototribe :)

Chimos’s picture

Title: Error when temporary directory is invalid » error when temporary directory is invalid

I had the same errors; I think the problem was that with updating, I deleted the 'tmp' folder, that doesn't come with the update, and then Drupal doesn't find it and shows error. To avoid this in the future I put 'tmp' inside 'sites', please, correct me if Im wrong:
The soution for me is:
1.- Creating a 'tmp' folder inside 'sites' folder (until this moment this was in the root, out of 'sites' folder)
2.- In Drupal admin go to 'configuration > File system'. There, in the field "temporal folder" write this path: "sites/tmp" and save.
3.- Flush cache in 'configuration > Performance'

Hope it helps

colan’s picture

Title: error when temporary directory is invalid » Error when temporary directory is invalid

I just surfed to ADMINISTRATION -> CONFIGURATION -> MEDIA -> FILE SYSTEM and resaved without changes. Then I cleared the cache, and everything was fine. No changes necessary.

liza’s picture

CONFIRMING STEPS in #4
also installing a localhost version of a dev-site that came from a Pantheon server and needed to do exactly this for the errors to clear.

thanks

Chimos’s picture

Title: error when temporary directory is invalid » Error when temporary directory is invalid
Tokoh’s picture

sqlwebpedia’s picture

I am doing a new installation with the Martplug distribution on shared hosting site. It looks like it has an invalid temporary directory with whatever is used by default on new installations. How can I change if I can't login to admin site?

•Warning: file_put_contents(temporary://filekYaJa7) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1904 of /var/www/vhosts/domain.com/httpdocs/includes/file.inc).
•The file could not be created.

Chimos’s picture

Maybe you can create a folder named 'tmp' in the root directory, this is what your Drupal needs, If this is the same problem I had. Drupal can not find this folder anymore (due to any update or something) and shows this warning.

This will be useful if your 'tmp' folder is set there in your 'config' (this is so by default).

I think then is necessary to clean your Drupal cache for the error-warning to go away. I don't know how to do this without accessing 'admin'. Maybe it happens automatically after some time?? (I don't kow)
This may help too with cache cleaning with php: http://drupal.org/node/42055

Anyway, I think this warning should not stop your log in. I would try to achive to log in first. And then follow #4 steps, to avoid this in future core updates.

Cheers

sqlwebpedia’s picture

I created tmp folders everywhere and deleted contents from cache table and still no luck. You can't login as the account is temporary when in middle of install process it seems and not sure of the password. I can start all over again, but think I will be in same spot again.

jhutar2’s picture

Version: 7.12 » 7.18
Priority: Normal » Major

I have just updated to 7.18 (running on OpenShift https://openshift.redhat.com/app/ - not sure if it is important) and seen same warnings.

I have tracked the problem to this function:

http://api.drupal.org/api/drupal/includes!file.inc/function/file_unmanaged_save_data

I do not know if file_put_contents can handle file path as an URI which is what drupal_tempnam('temporary://', 'file') returns here. So I made this hack in mine install:

-  $temp_name = drupal_tempnam('temporary://', 'file');
+  //$temp_name = drupal_tempnam('temporary://', 'file');
+  $temp_name = drupal_tempnam('/tmp/', 'file');
catch’s picture

Title: Error when temporary directory is invalid » Add hook_requirements() to ensure a valid temporary directory
Version: 7.18 » 8.x-dev
Category: bug » task
Priority: Major » Normal

You should check the file system configuration to make sure it's actually pointing to /tmp rather than hard-coding.

Sounds like this could use a hook_requirements() addition to ensure that the temp directory configuration points to a valid one.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Orkut Murat Yılmaz’s picture

Status: Active » Closed (outdated)