-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vsprintf(): Too few arguments #296
Comments
@rajnishmishra20 Thanks for reporting this. Could you provide the complete stack trace entry from |
@rajnishmishra20 Thanks, that helps. I will try to get a fix out today or tomorrow. |
@rajnishmishra20 Are you able to reproduce this in a model that doesn't use UUID? $parents = (new Book)
->where('author_id', 1)
->with('stores')
->with('publisher')
->withCount('stores')
->get(); |
Hi I am \Ramsey\Uuid\Uuid for primary keys This is Category::decodeUuid($uuid) 8eae24c5cd3a484fb95259066fa9e83f This is Category::encodeUuid( Hope this helps. |
@rajnishmishra20 Thanks, this helps. The problem is the question mark in the ID. I will see what I can do to work around this. Hopefully I will have an update ready sometime in the next few days. |
@rajnishmishra20 This should now be fixed in release 0.7.3. Could you let me know how that works for you? Thanks! |
Its fine now. Thanks! |
Hey Sorry to open this again but it did not work. I had MODEL_CACHE_ENABLED set to false After enabling , same error occurs My Query Category::with('word')->with('contents')->with('category')->doesntHave('category')->with('packswithcontents')->simplePaginate($pages) for a temporary access here is the url https://dev.coloursapp.com/api/content/v1/categories
|
Hi @rajnishmishra20, could you provide the stacktrace again, as well as the category UUIDs that cause this error? Thanks! |
Just saw you added the example link, thanks for that. select * from `categories` where `categories`.`id` in ('????????????????') and `categories`.`deleted_at` is null and `categories`.`deleted_at` is null |
Hi may be, I found the root of problem. when ever I try to egarload a relation with another elager loaded relation all having a binary id th problem occurs. Ex if from Category::with('word')->with('contents')->with('category')->doesntHave('category')->with('packs')->simplePaginate($pages); Suppose ->with('packs') contains another relation on model definition of relation the problem occurs if I remove ->with('contents') above it will work , else it will not. https://dev.coloursapp.com/api/content/v1/categories |
@rajnishmishra20 I need the values that are being passed in to work around the binary data. |
Some example categories array:22 [▼ array:1 [▼ array:21 [▼ Category::whereIn('id', $parents) passing last array in $parents makes the above exception some binary ids have """ |
@mikebronner, this exception happens to me frequently :-( My models uses \Ramsey\Uuid\Uuid too. An example:
Thanks for the great library. |
@mikebronner Sometimes the exception vsprintf(): Too few arguments and other times vsprintf(): Argument number must be greater than zero in CacheKey.php:233 It's to be used binary uuid I made the following fix in and the problem has not recurred:
|
@padre the UUID package you linked to should not be used as the primary key. However, I have added the code you recommended, as it does not break any test. Unfortunately the tests for this are very impractical. I would definitely appreciate a PR from you, if you have the time. Thanks! |
Closing this for now. Please check release 0.7.4 and let me know how it works for you. |
Hello, Document::select()
->with('author')
->whereIn('id', function ($query) use ($args) {
return $query->from('comments')
->select('document_id')
->distinct()
->where('user_id', auth()->user()->getAuthIdentifier()) // deleting this line and works nice
->where('folder_id', $args['folder_id'])
->whereNull([
'replaced_id',
'archived_at',
'deleted_at'
]);
})
->paginate($args['limit'], [], 'page', $args['page']); Laravel: 5.8 Stacktrace:
Digging into the code I realize that // so I changed from vvvvvvvvvvvvvvvvvvvvvvv
// $values = collect($this->query->bindings["where"][$this->currentBinding] ?? []);
// to
$values = collect(array_slice($this->query->bindings["where"], 1, substr_count($subquery, '?')) ?? []); after that everything seems to be running well (yet) genealabs:laravel-model-caching:mysql:prod:documents:documents:appmodelsdocument_*-sandbox_=_0-id_in_select_distinct_`document_id`_from_`comments`_where_`user_id`_=_zzzzzzzzzzzzzzzzzzzzzzz_and_`folder_id`_=_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx_and_`replaced_id`_is_null_and_`archived_at`_is_null_and_`deleted_at`_is_null-documents.deleted_at_null-mysql:prod:comments-comments.children-comments.children.user-comments.children.user.emails-comments.action-comments.events-comments.user-comments.user.emails-comments.user.organization-comments.user.organization.user-comments.link_orderBy_created_at_desc-paginate_by_60_page_1 |
Something weird happens here, my other environment $values = collect($this->query->bindings["where"] ?? []); |
@edtsz You indicate you are running Laravel 5.8. The most recent version is only compatible with Laravel 7.x. You mentioned you tried the latest version of the package, did you try it with Laravel 7? |
@mikebronner while testing I tried replacing |
@edtsz Sounds good ... sorry, we don't support older versions of this package. You're welcome to fork this project and make any fixes you need on your own branch for your own purposes. |
|
Describe the bug
Exception occurs when using eagerLoadRelation on Model with Cachable trait.
Eloquent Query
Stack Trace
vsprintf(): Too few arguments
Environment
Model uses \Ramsey\Uuid\Uuid for primary keys
The text was updated successfully, but these errors were encountered: