mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
UploadStream::stream_metadata is not implemented #4990
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#4990
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kale1d0code on GitHub (Apr 5, 2023).
Issue
UploadStream class hasn't implemented the stream_metadata static method and so anytime the crm needs to run touch, chmod, chown, or chgrp against a stream, it will fail.
Expected Behavior
import records and import files without issues or warnings
Actual Behavior
error message mentioned before is printed, and CRM record values are not updated.
Possible Fix
implement stream_metadata on UploadStream class
I have done the minimum to implement touch
Steps to Reproduce
Context
unable to import csv files to update records on mass
Your Environment
7.12.2
PHP
@pgorod commented on GitHub (Apr 5, 2023):
What is the PHP version where this doesn't currently work?
And do you have any special setting for the upload directory, or are you using the defaults?
I am not surprised at the incomplete implementation, and I agree it might be good to complete it (along with other fixes necessary in that class, it was actually better before but there have been regressions...). But I am surprised to hear that a simple CSV import doesn't work. Lots of people use it.
@chris001 commented on GitHub (Apr 5, 2023):
@kale1d0code Great find!
@pgorod It's required for PHP 5.4.0+, 7, 8.
Other PHP projects mention this issue and fixed it in 2017!
This should fix it:
@pgorod commented on GitHub (Apr 5, 2023):
I'm totally ok with this issue and with the proposed fixes.
My only question is this: have our CSV imports really been broken since PHP 5.4? I doubt that a lot and would love to know exactly what has been happening. And if they really are broken, there is likely an open issue somewhere.
@kale1d0code do you have a precise error message form the logs that we can use to search?
Thanks
@chris001 commented on GitHub (Apr 5, 2023):
What happened was, when upgrading to PHP 5.4, which requires this new
stream_metadata()function, users were getting failures on upload code from Sugar CE 6.5 written for PHP 5.3. SuiteCRM team resolved the issue on PHP 5.4+ by avoiding using stream instead using direct file system path name, not realizing that all they had to do to fix this upload stream issue was to add implementstream_metadata(), then uploads would work fine!@kale1d0code commented on GitHub (Apr 6, 2023):
@pgorod
I've got
and
@chris001 commented on GitHub (Apr 7, 2023):
Here's proof of this exact issue bug, reported on the community forum back in Feb 2020, 3+ years ago, and not resolved...
https://community.suitecrm.com/t/import-issues-stat-and-touch/71405
@pgorod commented on GitHub (Apr 8, 2023):
Nice PR, thanks 👍
Next up is going through all the instances of
'upload/'in the codebase (44 matches according to my PhpStorm) and changing them all to'upload://', and testing to see everything works fine, including with a changed setting for$sugar_config['upload_dir'].Some of those were working fine but got changed in the wrong way a few years ago to work around a problem with a phpmailer upgrade. But the correct approach would have been one of these two suggestions instead.
If that ever gets done, the fun part begins, which is to enjoy full file system redirection and quite easily do things like...
@kale1d0code commented on GitHub (Aug 30, 2024):
This is still an issue in at least 7.14.4
@SuiteBot commented on GitHub (Apr 17, 2025):
This issue has been mentioned on SuiteCRM. There might be relevant details there:
https://community.suitecrm.com/t/support-uploading-files-outside-of-web-root/99155/1
@kale1d0code commented on GitHub (Jul 21, 2025):
Still unable to upload files correctly in latest version of SuiteCRM