-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Bug]: Using WithLimit getting last record with null values #3439
Comments
Can you try to provide a failing unit test, that make it a lot easier to look into. You can also try if changing the |
If I've changed > to >= it gives me only 4 records. I'll share a failing unit test in sometime |
Perhaps the issue is in here then: https://github.com/Maatwebsite/Laravel-Excel/blob/44e165b73eaf182a2f699d905a20684889675b1c/src/Filters/LimitFilter.php#L37 |
yes. the issue in this line now I'm getting last record with proper values. thanks @patrickbrouwers |
@patrickbrouwers |
By default there's no limit. Code will only be ran if user has specified a limit, which will always be a value > 0 |
This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions. |
what is the solution now? just change the source code? |
currently that is the only solution. |
By using I'm still open to a PR if the bug can be backed by a unit test. |
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1.33
What version of Laravel are you using?
8.11.2
What version of PHP are you using?
7.3.32
Describe your issue
I want to get the first 5 records of the excel file. So, I've used WithLimit but when I get the 5 records the last record array contains all null values.
My Excel Sheet:
Controller code:
GetRowsImport
Output:
the highlighted in red is showing the last record with null values
If comment on the WithLimit I'll get all the records without null but I need only the first 5 records.
Output Without "WithLimit":
How can the issue be reproduced?
you can use the same code with excel sheet values given in the screenshot. you will get the same output that I'm getting.
What should be the expected behaviour?
Output:
it should not get null values in the last record as I've data in the 5row as well.
The text was updated successfully, but these errors were encountered: