jsonrainbow / json-schema

PHP implementation of JSON schema. Fork of the http://jsonschemaphpv.sourceforge.net/ project
MIT License
3.51k stars 347 forks source link

Type coercion not working properly in 5.2.13 #718

Open guvra opened 3 months ago

guvra commented 3 months ago

Hi,

I tried to use type coercion with version 5.2.13, but it's not working properly in many situations (e.g. no conversion to string, no coercion from arrays).

However, the issue seems to exist only for the 5.x.x branch. On the master branch, type coercion is working as expected.

Are there any plans to release a 6.0 version that includes these changes? If not, I can provide a PR that backports these changes into the 5.x.x branch.

DannyvdSluijs commented 3 months ago

@guvra thanks for your report. I'm currently trying to help out with a reboot of this repository and currently am doing triage on the issues and pull requests (#716) since the is a need for maintainers as the current maintainers are bound for time.

As far as have been able to determine right now the master branch is considered 6.x-dev and a release of v6 is very close. And any bug fixes for 5.x should be done against the 5.x.x branch.

I really love your offer of back porting fixes to 5.x.x but until the current maintainers (@erayd, @shmax and @bighappyface) either find time or appoint another maintainer I believe the repo is in a limbo state. And even if they point someone we need either @justinrainbow (the original maintainer) or @Seldaek (as per https://github.com/justinrainbow/json-schema/issues/658#issuecomment-826727657) to use their admin powers to grant permissions to said person. I would be more than happy to be that person but it requires someone else to make it so.

And if we can pull the repo from its limbo state I would prefer for the effort to go into getting v6.0.0 out of the door and take it from there. Meaning if someone really wants v5.x.x updated because of reasons (although v6 should be compatible with v5 I believe) we can always accept those PR's if they are raised. As mentioned below by Erayd these coercion changes did not find it way into v5 because of semantic versioning.

erayd commented 3 months ago

From memory, this difference between v5 & V6 is intentional. I've backported a lot over the years, and this was omitted by design.

It's been a number of years since we overhauled the type coercion (was something @shmax and I did) - if I remember correctly, we put the full type coercion changeset into v6, but did not want to introduce changes into v5 that would alter the behaviour of existing installations without warning.

I remain of the opinion that breaking behavioural changes should not be introduced within the same major version. This repo uses semantic versioning, and that principle is a pretty fundamental aspect of good versioning.

Seldaek commented 3 months ago

Yeah imo what's really needed is for someone to move forward with v6, drop php<7.1 or even <7.2, and mark v5 as security fixes only so we can simplify maintenance a bit and get all the new stuff out to those who need it.

How does this sound to you @erayd ? Because while i have commit access and am a long time user of the lib i have very little internal knowledge of it.