Commit graph

22 commits

Author SHA1 Message Date
90034ac1f8 Style fixes 2021-02-08 19:14:11 -05:00
bb89083444 Perform strict validation of query parameters
This is in fact stricter than Miniflux, which ignores duplicate values
and does not validate anything other than the string enumerations
2021-01-30 21:37:19 -05:00
e60f7ea03f Add class constant visibility 2020-03-01 18:32:01 -05:00
bc53a2d24a Style fixes 2020-03-01 15:16:50 -05:00
bbace7a0ac Use void and nullable return types where practical 2020-01-20 13:34:03 -05:00
c706a76057 Simplify array flattening 2019-10-18 13:10:03 -04:00
500851f161 Style fixes 2019-01-23 16:34:54 -05:00
5cd84c4ab4 Validate configuration parameters on import, and other changes
- Each parameter is checked for type and normalized
- Interval strings are converted to DateInterval objects
- Timeouts can be specified as interval strings
- Most intervals can be null to signify infinity
- Driver classes are checked that they implement the correct interface
- Short driver names may be used, and are used by default
- Helpful errors messages are printed in case of erroneous configuration

Exporting is currently broken; this will be fixed in an upcoming commit
2019-01-20 22:40:49 -05:00
b0643de21c Add handling of DateInterval objects to ValueInfo 2019-01-17 16:29:42 -05:00
81acba90dc Use strict equality when comparing strings 2019-01-11 10:38:06 -05:00
89bfc23d32 Standardize date normalization to immutables
Also move date formats to the ValueInfo class

Standardizing on immutables avoids any possible ambiguity in the API of the resultant value, as well as any ambiguity as to whether a DateTime output instance is the same instance or a clone (they had been clones)
2018-01-02 16:27:58 -05:00
87faededc6 Backport PDO changes to ValueInfo 2018-01-02 10:29:24 -05:00
73c8583744 Remove reliance on xdebug; fixes #113
Code coverage information is now gathered via phpdbg (a separate executable) by if available rather than xdebug, as the latter is hard to turn on and off.

A "test:quick" task has also been added to Robo, which excludes 31 tests which together account for almost two thirds of the test run time. This should pave the way for testing to be added as a commit hook for Git.
2017-12-17 10:27:34 -05:00
b8ed7c6bf8 Added missing static keyword to Misc\ValueInfo::normalize() 2017-12-10 11:16:06 -06:00
79f9808f1f CS fixes 2017-12-07 15:18:25 -05:00
11b2066922 Added per-file legal boilerplate
Includes PHPDoc license tag in the file-level block with accompanying copyright notice.

Also added an AUTHORS file on the off chance of outside contributions
2017-11-16 20:23:18 -05:00
65963f228f CS fixes 2017-10-20 18:41:21 -04:00
1271a0c8c0 Add ValueInfo::normalize method
This method provides generalized, consistent type casting more versatile than PHP's basic type juggling while hiding the significant complexity in achieving this.

While this commit does not change any existing code to use the new method, the intent is for both API handlers and database drivers to use the same basic rules for type conversion while still allowing for differing failure modes.
2017-10-19 15:18:58 -04:00
96ebf936e4 CS fixes 2017-09-28 09:01:43 -04:00
5ebf6cb689 Treat objects which are convertible to strings the same as actual strings in ValueInfo 2017-09-28 08:55:47 -04:00
d365529493 Multiple fixes to input sanitization
- Database functions now accept any input, but throw typeViolation exceptions where appropriate instead of idMissing or subjectMissing
- Added unit tests for the new Misc\ValueInfo static class
- Added ValueInfo::id() method to centrally validate database IDs, and made use of it consistently
- Made use of PHP's filter_var() function where appropriate when validating or sanitizing input
- Made the NCN protocol handler reject most invalid IDs before handing off to method handlers
- Made NCN's feedUpdate and subscriptionMove methods return 422 on invalid input
- Adjusted several tests to handler type violations
2017-09-27 22:25:45 -04:00
e74a3ae3cb Fix numerous bugs when adding or changing folders
- Specifying a non-integer parent no longer silently casts to 0 or 1
- Specifying a folder ID of 0 now always converts to null automatically
- Performing both a rename and move to root in the same operation no longer results in potential duplicates
- Calling folderSetProperties with an empty data array no peforms an update; it now returns false before the update call
- Modification timestamps are now actually updated when a folder is modified
- Constraint violation exceptions triggered by code (rather than the database) now print a message
- Renaming a folder or subscription to a non-string value (e.g. an array) throws an exception rather than silently casting
- Added tests to better cover all the above
- Centralized the normalization of integers and title strings into a new ValueInfo static class
2017-09-26 16:45:41 -04:00