Repository navigation
Fix/php82 open issues - #60
Merged
Merged
Conversation
Drop PHP 5/7 support. Add ext-mbstring requirement, upgrade dev dependencies to PHPUnit 10 and Psalm 6. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Day, month, hour, minute and second tokens (d, m, h, H, i, s) were rendered without leading zeros. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move server dependent tests to tests/integration - Add offline tests/unit suite with a FakeFileMaker transport and response fixtures - Add phpunit.xml.dist failing on deprecations/notices/warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Drop curl_close() calls (no-op since PHP 8.0, deprecated in 8.5) - Drop xml_parser_free() calls (deprecated in 8.5) - Use first-class callables for XML handlers instead of xml_set_object() + method names (deprecated in 8.4) Fixes #57 Supersedes #59 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use mb_convert_encoding() through new toInputCharset() and existing toOutputCharset() helpers. Arrays sent to the Data API are now JSON encoded before charset conversion. Fixes #52 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Cast CWP parameters to string before url encoding (extracted to buildCwpQuery()) - Initialize Data API body for -new queries, array_merge(null, ...) threw a TypeError when no field data was provided Fixes #48 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
FileMaker Data API rejected the lowercase schemes with "Authorization header missing 'Basic' or 'Bearer'". The composer constraint now also allows PHP 8 (see previous commit). Fixes #54 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tokens were never reused nor released, exhausting FileMaker Server connections (error 812): - getToken() now saves the token through setToken() so it is reused by next requests (session handler or active PHP session) - __destruct() had an operator precedence bug; it now only logs out tokens that could not be saved, reads raw properties and ignores any Throwable during shutdown - __set() only forwarded to setters without parameter, so setSessionHandler(), setCache() and $fm->token = null were no-ops - Expired tokens are removed from the session when renewed, logout always forgets the token - Login/transport errors are returned instead of being used as token - Add logout() and isTokenPersisted() Fixes #56 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
"XML error: Not well-formed (invalid token) at line 1" was raised whenever FileMaker Server answered with something else than XML (HTTP to HTTPS redirect, disabled XML publishing page...). - Collect response headers with CURLOPT_HEADERFUNCTION instead of mixing them with the body - Report redirects with their target location - Report non XML responses with HTTP status, content type, an excerpt and hints (hostspec, XML Web Publishing, Data API) - Strip BOM and leading whitespaces before parsing - Don't call setcookie() once headers are sent Fixes #50 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Compare logLevel as integer, allow false to disable logging - Mask Data API password and session token in logs, profiling keys and getLastRequestedUrl() - Log container data size instead of the raw binary at debug level - Test that messages above logLevel are never forwarded to the logger Fixes #42 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record::setField() already converts dates from the dateFormat property, Record::commitAdd() now passes useRawData to the Add command like commitEdit() does. Fixes #35 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Edit commands (and Record::commit() on existing records) failed prevalidation when required fields were not part of the update. Fixes #19 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When enabled, prevalidation ignores auto-entered fields (ie: serial primary keys) left empty, FileMaker Server populates them on creation. Provided values are still validated. Disabled by default. Fixes #36 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document PHP 8.2+ requirements and hosting (Linux/cPanel), Data API token handling, prevalidation options, logging, troubleshooting and changelog. Fixes #55 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Field::check*Format() passed null to preg_match() (PHP 8.1 deprecation, see #48) - FileMakerValidationException::getMessage() started with a generic 'Unknown error' line before the validation errors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- phpunit.sample.xml contained '--' inside an XML comment (invalid XML) - Fix relative paths of moved tests, declare dynamic properties - Derive engine from USE_DATA_API ($GLOBALS['ENGINE'] was never defined), fix an assignment used as condition Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- hasValidationRule() used isset() on the integer validation mask and always returned false; check parsed validation rules instead (the mask can't be used either: rule constants are not powers of two) - getErrorString(null) used null as array offset (PHP 8.5 deprecation) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Layouts were cached statically with a reference to the FileMaker instance that loaded them: records created from a cached layout were committed through another instance (other engine, settings and credentials). Found running the integration suite in Data API mode. - Cache key includes the engine (CWP and Data API metadata differ) - getLayout() returns a copy bound to the current instance when the cached layout belongs to another one or comes from an external cache - Layout/RelatedSet no longer serialize the FileMaker instance, which leaked credentials into external caches (now effective since setCache() is fixed) - Layout::loadExtendedInfo() cached under a wrong key Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- tests/filemaker-test.fmp12 replaced by tests/php-api-test.fmp12.zip, updated with the fields, relationships and Data API access required by the integration suite - Ignore extracted tests/*.fmp12 - Use DB_FILE instead of a hardcoded database name in tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Unit tests and lint on PHP 8.2 to 8.5 - Integration tests on PHP 8.2/8.5 for CWP and Data API against the hosted test database, configured with FM_HOST/FM_DATABASE variables and FM_USER/FM_PASSWORD secrets; jobs run sequentially since they share the database, skipped for forks - tests/bootstrap.php maps FM_* environment variables to test settings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP 8.2+ only, fix all open issues (3.1.0)
Drops PHP 5/7 support (
"php": "^8.2"), fixes every open issue, and migrates the tests to PHPUnit 10 with a new offline suite. It has no deprecation notices from PHP 8.2 through 8.5.Fixes #19, fixes #35, fixes #36, fixes #42, fixes #48, fixes #50, fixes #52, fixes #54, fixes #55, fixes #56, fixes #57
Supersedes #59 (thanks @precursorca)
Changes (one commit per issue)
curl_close()andxml_parser_free()(deprecated in 8.5). XML handlers are now first-class callables instead ofxml_set_object()plus method names (deprecated in 8.4). The exact message quoted in #57 comes fromairmoi/yii2-fmconnector(FileMakerActiveRecord::findAll()), so it needs a separate fix there.utf8_encode/utf8_decodewithmb_convert_encoding(newtoInputCharset()helper).buildCwpQuery()). Also fixed aTypeError(array_merge(null, …)) on Data API-newqueries that have no field data.Basic/Bearerinstead of lowercase.Throwable.__set()ignored setters that take a parameter, sosetSessionHandler(),setCache()and$fm->token = nulldid nothing. Expired tokens are removed from the session when renewed. Addedlogout()andisTokenPersisted().CURLOPT_HEADERFUNCTION. Redirects (e.g. HTTP→HTTPS) and non-XML responses now give an explicit error with the HTTP status, content type, an excerpt and hints. A BOM or leading whitespace is stripped before parsing.logLevelis compared as an integer, the Data API password and session token are masked in logs, profiling keys andgetLastRequestedUrl(), and container binaries are no longer dumped at DEBUG level.Record::commitAdd()passesuseRawDataso dates aren't converted twice.skipAutoEnteredValidation: when on, prevalidation skips empty auto-entered fields.Also:
Field::hasValidationRule()always returned false.Field::check*Format()passed null topreg_match().FileMakerValidationException::getMessage()started with a stray "Unknown error" line.getErrorString(null)triggered a PHP 8.5 deprecation.FileMakerinstance that loaded them, so records could be committed through another instance (other engine, settings and credentials). Layouts are now cached per engine and rebound to the requesting instance, and they no longer serialize the instance and its credentials into external caches.DateFormat::convertWithWildCards(); the existingDateFormatTestwas failing.apiVersionis now 3.1.0. Added theext-mbstringrequirement. Dev dependencies are now PHPUnit 10.5 and Psalm 6.Tests
tests/integrationand migrated to PHPUnit 10. Fixed in passing:phpunit.sample.xmlwas invalid XML, relative paths broke when the tests moved,$GLOBALS['ENGINE']was never defined, and one test hardcoded the database name.tests/unit(64 tests) using aFakeFileMakertransport, with regression tests for each fix.phpunit.xml.distfails on deprecations, notices and warnings.FM_HOST,FM_DATABASE,FM_USER,FM_PASSWORDandFM_USE_DATA_APIenvironment variables, which overridephpunit.xml.tests/filemaker-test.fmp12is replaced bytests/php-api-test.fmp12.zip. It has been updated with the fields, relationships and Data API access the integration suite needs. Unzippedtests/*.fmp12files are gitignored.CI (
.github/workflows/tests.yml)master, and manual triggers. A new push to the same PR cancels the run in progress.composer.json, syntax-checks every PHP file, and runs the unit suite on PHP 8.2, 8.3, 8.4 and 8.5.FM_HOSTandFM_DATABASErepository variables, and theFM_USERandFM_PASSWORDrepository secrets.Verification
php -land the unit suite is green.php-api-teston dev1.fmcloud.fm: the full suite (64 unit + 169 integration tests) is green on PHP 8.2 and 8.5, in both CWP and Data API mode. It was also run the way CI does (phpunit.xml.distwithFM_*env vars).actionlint.master, and none new.Behavior changes to note
$_SESSIONwhen a PHP session is available, as the README already described. Before, they were never stored.setSessionHandler()andsetCache()now actually take effect.https://hostspec.