Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8::downgrade() FAIL_OK argument should not be treated as an integer #13684

Closed
p5pRT opened this issue Mar 21, 2014 · 10 comments
Closed

utf8::downgrade() FAIL_OK argument should not be treated as an integer #13684

p5pRT opened this issue Mar 21, 2014 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 21, 2014

Migrated from rt.perl.org#121486 (status was 'resolved')

Searchable as RT121486$

@p5pRT
Copy link
Author

p5pRT commented Mar 21, 2014

From @demerphq

utf8​::downgrade($foo,"fail_ok");

Produces​:

Argument "fail_ok" isn't numeric in subroutine entry

Cause is calling SvIV() on the argument​:

const bool failok = (items < 2) ? 0 : (int)SvIV(ST(1));

Solution is to use SvTRUE() instead.

Fix is complete and is waiting test pass to push.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Mar 21, 2014

From @demerphq

On 21 March 2014 17​:50, demerphq <demerphq@​gmail.com> wrote​:

utf8​::downgrade($foo,"fail_ok");

Produces​:

Argument "fail_ok" isn't numeric in subroutine entry

Cause is calling SvIV() on the argument​:

const bool failok = (items < 2) ? 0 : (int)SvIV(ST(1));

Solution is to use SvTRUE() instead.

Fix is complete and is waiting test pass to push.

smoke-me/fix_perl121486

passes all test. I am told we are under a code freeze so I have not
merged the commit, but it is a simple path​:

commit 939b91a
Author​: Yves Orton <demerphq@​gmail.com>
Date​: Fri Mar 21 17​:47​:45 2014 +0100

  utf8​::downgrade($x,FAIL_OK) is not supposed to treat FAIL_OK as an integer

Inline Patch
diff --git a/universal.c b/universal.c
index bccc8fb..dde37bc 100644
--- a/universal.c
+++ b/universal.c
@@ -513,7 +513,7 @@ XS(XS_utf8_downgrade)
        croak_xs_usage(cv, "sv, failok=0");
     else {
        SV * const sv = ST(0);
-        const bool failok = (items < 2) ? 0 : (int)SvIV(ST(1));
+        const bool failok = (items < 2) ? 0 : SvTRUE(ST(1)) ? 1 : 0;
         const bool RETVAL = sv_utf8_downgrade(sv, failok);

        ST(0) = boolSV(RETVAL);

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

From @khwilliamson

This was fixed by 3ca75ec
but not resolved at the time
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

@khwilliamson - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

From @khwilliamson

Reopening so can change to pending release
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

@khwilliamson - Status changed from 'resolved' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2014

@khwilliamson - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

From @khwilliamson

Thanks for submitting this ticket

The issue should be resolved with the release today of Perl v5.22. If you find that the problem persists, feel free to reopen this ticket

--
Karl Williamson for the Perl 5 porters team

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant