When using devel_generate, I get the following error when generating nodes with attached images stored in Storage API containers:

Missing argument 2 for DrupalStorageStreamWrapper::url_stat()

I'll attach a quick and dirty patch to tide me over. I think the proper fix should probably happen in devel_generate instead.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wulff’s picture

...and the patch.

30equals’s picture

I saw the same problem, but for what it's worth, i'd fix it where the function get's called, instead of giving a default value - just to maintain consistency with the main Class ?

wulff’s picture

Hm. I still think it would make sense to fix it in Storage API according to the definition of url_stat on http://www.php.net/manual/en/class.streamwrapper.php.

Perignon’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)

This is an old issue. Is it still valid?

Silicon.Valet’s picture

Perignon’s picture

Assigned: Unassigned » Perignon
DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
516 bytes

There's no point in keeping the argument because it isn't actually used in the method.

jonhattan’s picture

The method should at least test STREAM_URL_STAT_QUIET flag and behave in consecuence (do not raise an exception). It is already implemented in the storage_api_stream_wrapper module - http://cgit.drupalcode.org/storage_api_stream_wrapper/tree/StorageApiStr...

DamienMcKenna’s picture

@jonhattan: Could you please update the patch with at least some comments or pseudocode on what you should it should be? I've not looked at Storage API before so have absolutely no clue :)

jonhattan’s picture

FileSize
672 bytes

Committing attached patch.

Just realized I'm a maintainer of this module! Thanks!? @Perignon :D

Perignon’s picture

;-) I appreciate the help a lot!

  • jonhattan committed 6fe61a9 on 7.x-1.x
    Issue #1899016: Missing argument 2 for DrupalStorageStreamWrapper::...
jonhattan’s picture

Status: Needs review » Fixed
Perignon’s picture

I will try and keep the Github and Bitbucket repo's up to date.

DamienMcKenna’s picture

Status: Fixed » Needs work

But that's a workaround rather than an actual fix for the simple problem that a required variable in the method isn't actually used.

jonhattan’s picture

We loose the focus here. class DrupalStorageStreamWrapper implements DrupalStreamWrapperInterface, DrupalStreamWrapperInterface extends StreamWrapperInterface. StreamWrapperInterface is a Drupal class that provides an interface for the PHP prototype of a stream wrapper class - http://www.php.net/manual/en/class.streamwrapper.php

So we want to follow the interfaces signature: public function url_stat($uri, $flags);, and thus we need to pass a value for flags in all of our calls.

  • jonhattan committed 69250df on 7.x-1.x
    Follow-up to issue #1899016: Missing argument 2 for...
jonhattan’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.