Topic: issue with image uploader in svmanager after php upgrade to 5.3.4

hi
just recently had issues with the uploader
firstly on chrome it just crashes my browser
on firefox it works but after uoploading a image
i get this mesage 4 times in red at top of page

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unknown option bit(s) set at offset -1 (gallery.php, line 687)


googled this and found simialr issues from worpdess users after php was upgraded
http://wordpress.org/support/topic/warn … tch-errors

from 5.3.3 to 5.3.4

Jack can you provide a fix for this? rather than asking host to go back to eearlier php version?
i actually downloaded another version of svmanager thinking the issue was with the java uploader
so I paid my $35
then realized it wasnt the svmnager but the host upgrading php
i dont mind paying the $35 as now i get to use Juice Box in future smile
but hoping you can help me edit code to work with newer version of php rather than asking host to go back to earlier version

thanks!

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

Good question … I'd like to know as well. Thanks, guys.   cool

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

hmm seems my server had recently been upgraded from 5.2.17.
to 5.3.13
as i urgently need to update a gallery i asked them to revert back to this

which theyve done
but now same issue

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unknown option bit(s) set at offset -1 (gallery.php, line 687)

help!!

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

This one is new to me. It seems that the PCRE (Pearl Compatible Regular Expression) extension is simply not working since the server upgrade. Although it's called an extension, PCRE is provided by default so it should be possible to rely on it.

I've been googling too and I don't think it's associated with a particular version of php. The common factor seems to be that it happens when php has been compiled with an out of date or incompatible version of PCRE. It's also possible that UTF-8 support is missing and contributing to the problem. This is one of the more authoritative pages I found on Google – http://stackoverflow.com/questions/2106 … port-utf-8

So it doesn't look like something you can fix yourself.

I could show you how to bypass the one line that's throwing an error but svManager uses PCRE in maybe 30 different lines of code, so that will probably just move the problem on and it might be worse next time.

Try leaning on your server support again and please let us know the outcome.

jack

Jack Hardie
SimpleViewer Support Team.

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

thanks jack!
will send your description on to my tech support and post back with results
thanks again

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

reply from tech team

====
Thank you for your co operation so far. We appreciate your patience as well.

While we investigate this, we could see it is an exception/runtime error thrown as the return value of the function  'preg_match_all()' .

If we can go little extended from our scope of support the regular syntax of the function is as follows,

int preg_match_all ( string $pattern , string $subject , array &$matches [, int $flags ] [, int $offset ] )

The inappropriate input values for this function parameters could also be an issue while executing.  And this is obvious PHP code and doesn't relate much with the hosting functions. 

However, technically the PHP version compatibility could also be a part of the problem. We shall place the right version of the PHP on the server as recommended by your development team.

So we would require you to confirm with us the precised PHP version you would like to deploy on the server for this function be executed successfully.

Once confirmed, we shall try with the recommended version of PHP and check if that helps. So please review the the PHP script with the development team and please get back for further assistance.

Please share with us your additional queries.

Your server's current PHP version is 5.2.17 and the available versions are,

5.2.9
5.3.15
5.3.16
5.4.6

===

Jack, what should me next response be?
thanks

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

You are currently running php version 5.2.17. My server runs the same version and I'm not seeing the same problems so it doesn't look like it's a simple matter of choosing the php version.

Let's see if we can construct a minimum test case to eliminate all the complexity of svManager. Can you create a file called say test.php and upload it to your server? It has to be a plain text file not Word format or rtf.

This is the content. You should be able to copy and paste it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>PCRE test</title>
</head>
<body>
    <h1>PCRE test</h1>
<?php
    phpinfo();
    print '<pre>';
    var_dump(preg_match_all('(.*\.((jpe?g)|(png)|(gif))$)ui', 'test.jpg', $matches));
    var_dump($matches);
    print '</pre>';
?>
</body>
</html>

This will run phpinfo which should produce a lot of information about your php setup. Then it will try to run the offending line to see if the same error occurs.

Let me know where I can find this file on your server so I can check the output. If you don't want to post urls here then email me via the forum.

jack

PS One more thought. Do the names of any of the files you are uploading contain accented characters or umlauts or anything like that? If so try a file name with plain abc... 123... I'm thinking of a possible utf connection here.

Jack Hardie
SimpleViewer Support Team.

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

Very interesting.

If you look to the end of the output, you'll see that the error is still there, so the PCRE function on its own outside svManager is still blowing-up. That's good news – diagnosis is a lot simpler if we can reproduce the problem with one line of code.

The phpinfo output is interesting as well:
It seems you are running php v5.3.15
The PCRE version is version 6.6 dated 06-Feb-2006

Take a look at this post – the guy fixed a similar problem to yours by upgrading PCRE on the server to the current v8.10.

Before you go back to your server people, there is one more thing we could try. Could you change one line in the test script as follows:

var_dump(preg_match_all('(.*\.((jpe?g)|(png)|(gif))$)i', 'test.jpg', $matches));

It's almost the same as the previous version except that I've deleted a single lower case u. The u stands for utf-8 character support. I don't see any utf-8 support in the output from phpinfo so that could be contributing to the problem.

jack

Jack Hardie
SimpleViewer Support Team.

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

hi jack,
i made the change as requested to the test.php file

please refer to it again from my email to you

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

Ah – we no longer get the error.

I think you can remove the lower case letter u from svManager. Since your server doesn't seem to support unicode anyway then you probably won't lose anything. I've checked through the code and I think the other calls to PCRE won't cause a problem. I think it's just the one line of code but we can't be 100% sure till we try it.

So take a backup.

Edit the file svmanager/classes/gallery.php

Line 687 should look like this:

return (0 != preg_match_all('(.*\.((jpe?g)|(png)|(gif))$)ui', $fileName, $matches));

If you have any problem finding it then search for function isImage
Delete the u so the line reads:

return (0 != preg_match_all('(.*\.((jpe?g)|(png)|(gif))$)i', $fileName, $matches));

It remains a mystery why it used to work on your server and now it doesn't. I still think there is a problem with the server setup since the upgrade but if we can get it working with svManager then we don't need to worry about that.

jack

Jack Hardie
SimpleViewer Support Team.

Re: issue with image uploader in svmanager after php upgrade to 5.3.4

hi jack that seems to have worked thanks very much!