As reported in #1205948: Installing new modules fails after update from 7.2 -> 7.4:

Notice: Use of undefined constant WATCHDOG_ERR - assumed 'WATCHDOG_ERR' in file_unmanaged_copy() (line 909 of /var/www/vhosts/schoolenberg.info/httpdocs/includes/file.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bfroehle’s picture

Component: file.module » file system
Status: Active » Needs review
Issue tags: +Novice
FileSize
1.01 KB

Attached patch renames WATCHDOG_ERR to the (correct) WATCHDOG_ERROR.

This bug is not relevant to D8, since WATCHDOG_* was renamed to use the builtin PHP constants.

bfroehle’s picture

Version: 7.x-dev » 8.x-dev
bfroehle’s picture

James_Stallings’s picture

Applied and tested. Looks good. Needs one more review.

franz’s picture

Status: Needs review » Reviewed & tested by the community

Not much to see in here. Plain and simple.

teot’s picture

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests, +Needs backport to D7

Well that's a stupid bug.

But moreover, we have no tests for file_unmanaged_copy()?? Why is this not being caught?

bfroehle’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs tests, -Novice

How are you supposed to write a test for a failing copy() command, without tripping any of the previous checks in file_unmanaged_copy()? These ideas will not work since they'll be caught by another check:

  1. Copy to a non-existing directory. (Actually the directory will be created)
  2. Copy to a directory which we don't have write privileges.
  3. Copy destination is a read-only file which already exists.

I think we should just fix this and move on. The only way I've seen this caused in the wild is in odd PHP configurations with safe mode enabled (which is not an option for the test bot).

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, fair enough. :)

Committed and pushed to 8.x. Apparently 7.x already had this fix applied.

Anonymous’s picture

I just got this in 7.7...

bfroehle’s picture

stevepurkiss: This was fixed in 3ed6929 in Drupal 7, which came after the release of 7.7. It's fixed in the dev release and in the next stable release.

Anonymous’s picture

bfroehle: ah ok thanks!

Jens Peter’s picture

I just got this error in 7.7 too. Fresh download of Drupal install and running the update with no errors.
When I move to front page after update it gave this error.

Use the link in #11 and corrected the file.inc like I would do as a patch.
All seem to work now.

Just wanted to write in case someone other than me was looking and couldn't find a solution.

bfroehle’s picture

This was fixed in 3ed6929 in Drupal 7, which came after the release of 7.7. It's fixed in the dev release and in the next stable release.

The correct error message is "The specified file %file could not be copied to %destination." (with file and destination replaced appropriately).

Ionut Adrian Luchian’s picture

Status: Fixed » Needs review
Issue tags: -Needs backport to D7

not working

Status: Fixed » Needs work

The last submitted patch, 1206916-by-bfroehle-Fixed-Notice-Use-of-undefined-co.patch, failed testing.

Eric_A’s picture

Status: Needs work » Fixed
bfroehle’s picture

Status: Needs review » Closed (fixed)
Issue tags: +Needs backport to D7
Josh Waihi’s picture

Version: 8.x-dev » 7.x-dev
Status: Closed (fixed) » Active

So if this is fixed can it be backported to 7?

franz’s picture

Status: Active » Closed (fixed)

Please read comment #11

Eric_A’s picture

Version: 7.x-dev » 8.x-dev
deajan’s picture

Version: 8.x-dev » 7.7

#11 fixed my issue while upgrading from D 6.22 to D 7.7.
Thanks.

franz’s picture

Version: 7.7 » 8.x-dev

This issue was about fixing for 8.x

pawi81’s picture

I have same issue

I was trying to upgrade from 7.4 to 7.7, there was no errors imho

and after i refreshed page i have:

  Notice: Use of undefined constant WATCHDOG_ERR - assumed 'WATCHDOG_ERR' w file_unmanaged_copy() (linia 909 z /var/customers/pawi.pl/includes/file.inc).
    PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'WATCHDOG_ERR' for column 'severity' at row 1: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => The specified file %file could not be copied to %destination. [:db_insert_placeholder_3] => a:2:{s:5:"%file";s:22:"temporary://filelnhPek";s:12:"%destination";s:68:"public://languages/pl_XrWf5aj9dzKeVWHAAvikUPjIqcDzl2cPaK1pik9M3mk.js";} [:db_insert_placeholder_4] => WATCHDOG_ERR [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://pawi.pl/update.php?op=info [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 95.49.211.161 [:db_insert_placeholder_9] => 1313665004 ) w dblog_watchdog() (linia 157 z /var/customers/pawi.pl/modules/dblog/dblog.module).

Sorry i didn't see

http://drupal.org/node/1206916#comment-4802328 fixed it :)

rickumali’s picture

I wanted to post a Thank You also. This fix allowed my upgrade from Drupal 6.22 to Drupal 7.7 to continue.

nikkubhai’s picture

I got error in d7.7

franz’s picture

nikkubhai: read #11, and look for it next time.