luads / php-xbase

A simple parser for *.dbf files using PHP
MIT License
184 stars 84 forks source link

Wrong fieldCount calculation after update #83

Closed rtfmfm closed 4 years ago

rtfmfm commented 4 years ago

Hi! After the update of the app from Laravel 5.7.11 to 7.21.0 without any other change, I'm getting this error: Wrong fieldCount calculation when trying to read an dbf file. $table = new Table('file.dbf', null, 'CP1251'); It was working when I was using Laravel 5.7.11 and php-xbase 1.0.5 Now it's not working on Laravel 7.21.0 and php-xbase 1.1.0.

When I'm trying to use Laravel 7.21.0 and php-xbase 1.0.5 there is another error: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior related to vendor/hisamu/php-xbase/src/XBase/Column.php:24

Can you, please, advise me on how to solve this?

Thank you in advance!

gam6itko commented 4 years ago

@rtfmfm can you give us your dbf file?

gam6itko commented 4 years ago

@rtfmfm update to version 1.0.7 to solve 'chr issue'

rtfmfm commented 4 years ago

@gam6itko, thank you for your immediate response! Can I send the original file directly to you? If not, I'll remove some data and the can share it here.

rtfmfm commented 4 years ago

@gam6itko, I just did one test. If I open the dbf file with LibreOffice and just save it the problem is solved. Maybe it's the file, not the application.

gam6itko commented 4 years ago

@rtfmfm if it not contains private information you can drop it here. You also can send it to gam6itko@gmail.com

gam6itko commented 4 years ago

@gam6itko, I just did one test. If I open the dbf file with LibreOffice and just save it the problem is solved. Maybe it's the file, not the application.

Some files has 2bytes-terminator (0x0D00). I don't actually know which application creates dbf files in that way.

I guess I've fixed that in deba186ca23bc0867a14562539562c8c6c8327a0. Can you update to dev-issue_83 and check it?

rtfmfm commented 4 years ago

Some files has 2bytes-terminator 0x0D00. I don't actually know which application creates dbf files in that way.

I guess I've fixed that in deba186. Can you update to dev-issue_83 and check it?

Thank you very much for the update. I'll be able to test it on Monday and will report the result.

rtfmfm commented 4 years ago

Hello, today I managed to test the dev-issue_83 version and it is working as expected. I was able to open and read a dbf file without getting the error.

Thank you!