box / spout

Read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
http://opensource.box.com/spout/
Apache License 2.0
4.23k stars 636 forks source link

Catchable fatal error: Argument 1 passed to Box\Spout\Common\Helper\FileSystemHelper #825

Open harjindermankoo opened 3 years ago

harjindermankoo commented 3 years ago

Hi I wonder if you can help. I have large excel files and am trying to combine them into one. I am getting the error Catchable fatal error: Argument 1 passed to Box\Spout\Common\Helper\FileSystemHelper::__construct() must be an instance of Box\Spout\Common\Helper\string, string given, called in /xxx/xxx/xxx/xxxx/website.com/vendor/spoutsrc/Spout/Writer/XLSX/Helper/FileSystemHelper.php on line 63 and defined in /xxx/xxx/xxx/xxxx//vendor/spoutsrc/Spout/Common/Helper/FileSystemHelper.php on line 20

replaced actual location with x's

PHP ver 7.2.33 Spout 3.2.0 I think. If you tell me how I can actually check that would be helpful

Any help appreciated

adrilo commented 3 years ago

Hi ! For some reasons, the string typehint defined here: https://github.com/box/spout/blob/9533accd73edc020072bc7a4f0c0ddb28a5b701f/src/Spout/Common/Helper/FileSystemHelper.php#L20 is interpreted as belonging to the class itself. This should not be the default behavior (as you can see here: https://3v4l.org/dUDYE). One way you can work around the issue is to add a backslash before the string (=> \string). Otherwise, I'm not sure why you are experiencing this issue...