Author |
Message |
mtassinari
Joined: 17 Oct 2013 Posts: 6
|
Posted: Tue May 12, 2020 8:44 am Post subject: Option to continue in case of encoding error |
|
|
Good morning,
I was looking into the docs, but I couldn't find if such an option exists.
Basically, what I would like is, if encryption of a file fails for some reason, it should be copied unencrypted in the target location.
Does such option exist? |
|
Back to top |
|
 |
alastair
Joined: 23 Feb 2010 Posts: 407
|
Posted: Tue May 12, 2020 10:08 am Post subject: |
|
|
Hi,
I guess you mean encoding of PHP files rather than encryption. Is that right?
Why would such functionality be useful? If encoding of a PHP file fails then it means that the file contains invalid PHP (at least for that encoding source language). Therefore if it were copied then you would have an invalid unencoded PHP file in the target.
Furthermore. as encoding would have continued, it would be difficult to spot that encoding on a particular file (or files) had failed. _________________ Alastair
ionCube |
|
Back to top |
|
 |
mtassinari
Joined: 17 Oct 2013 Posts: 6
|
Posted: Tue May 12, 2020 10:20 am Post subject: |
|
|
alastair wrote: | I guess you mean encoding of PHP files rather than encryption. Is that right? |
Yes, sorry, I used the wrong word there.
alastair wrote: | Why would such functionality be useful? If encoding of a PHP file fails then it means that the file contains invalid PHP (at least for that encoding source language). Therefore if it were copied then you would have an invalid unencoded PHP file in the target. |
I found myself in a sort of edge case, in which I use PHP 7.0, which has no own encoder, so I encode files with the encoder for PHP 5.6; however, that encoder can fail on files that are actually valid in version 7.0 but not in 5.6.
So, instead of having a missing file in the target folder of the encoding process, I think it'd be preferable to have the file in plain. |
|
Back to top |
|
 |
alastair
Joined: 23 Feb 2010 Posts: 407
|
Posted: Tue May 12, 2020 11:07 am Post subject: |
|
|
Hi,
Thanks for the clarification.
Would it not be better then to use the 7.1 Encoder, especially bearing in mind that PHP 7.0 reached its end of life 16 months ago? Otherwise, with the scheme you are suggesting, you could end up with many files that were unencoded in the target. You would also need to ensure that you did a 7.0 syntax check prior to encoding (with "php7.0 -l") so as to distinguish between "real" syntax issues and those arising from using the 5.6 Encoder.
If you are using bundled encodings (like the "5.6 & 7.1" option in the GUI), your suggestion also means that the second encoder, that would expect to find bundled encoded files, would have to ignore any unencoded file it found. _________________ Alastair
ionCube |
|
Back to top |
|
 |
mtassinari
Joined: 17 Oct 2013 Posts: 6
|
Posted: Tue May 12, 2020 11:11 am Post subject: |
|
|
alastair wrote: | Would it not be better then to use the 7.1 Encoder, especially bearing in mind that PHP 7.0 reached its end of life 16 months ago? |
Yeah, I know, and you're right, it'd be the best thing to do.
As of now we are still in a transition phase, so we still need to support PHP 7.0, with plan to upgrade to PHP 7.4 by the end of the year.
That's why I was asking about such option, but if it's unavailable, I can simply prepare a script which would scan the source folder and copy in the target folder any missing php file. |
|
Back to top |
|
 |
alastair
Joined: 23 Feb 2010 Posts: 407
|
Posted: Tue May 12, 2020 5:29 pm Post subject: |
|
|
Hi,
Unfortunately I do not think we would add such the feature you suggested to a future version of the Encoder because there is too much risk for the unwary. That is, somebody unfamiliar with the Encoder might alight upon such an option and use it to "fix" the problems they were having encoding. _________________ Alastair
ionCube |
|
Back to top |
|
 |
mtassinari
Joined: 17 Oct 2013 Posts: 6
|
Posted: Wed May 13, 2020 7:32 am Post subject: |
|
|
Yes, I understand, and honestly agree, thanks for the feedback anyway! |
|
Back to top |
|
 |
jimp
Joined: 09 Sep 2014 Posts: 2
|
Posted: Fri Mar 12, 2021 8:09 pm Post subject: |
|
|
An option to continue would be helpful with bundling. As if stands now, if a single file in a folder to encode fails, the next bundle of the encoder stops on that file and doesn't continue.
My project has some files that are meant for older PHP versions and some for newer versions. The code knows when to use the file or not, so it doesn't matter if those files are omitted from the encoded result since they won't be included anyway. Because the option --bundle and --add-to-bundle apply to the entire folder, encoding with 7.2 first will result in --add-to-bundle on 7.1 and 5.6 with a file that doesn't exist.
This is an edge case that can probably be fixed with some specific command overrides per encoder pass, but regardless the setup is actually difficult to work with because the encoder doesn't have an option to ignore errors and continue. It will require a careful mix of --bundle and --add-to-bundle, also negating the simplicity of encoding the entire folder. If --bundle could create-or-add that would also help. |
|
Back to top |
|
 |
|