Skip to content

phpspec/php-diff deprecated exception #969

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

Closed
crtlib opened this issue Oct 12, 2013 · 12 comments
Closed

phpspec/php-diff deprecated exception #969

crtlib opened this issue Oct 12, 2013 · 12 comments
Assignees
Milestone

Comments

@crtlib
Copy link
Contributor

crtlib commented Oct 12, 2013

When using Gii with php 5.5 I'm getting exception that using preg_replace with '/e' modifier is deprecated in php-diff/lib/Diff/Renderer/Html/Array.php:180. Here is a fix:

        $line = preg_replace_callback('# ( +)|^ #', function ($m) {
                return $this->fixSpaces(isset($m[1]) ? $m[1] : '');
            }, $line);

And my question is - should we fix it at phpspec/php-diff or should we fork it and do it ourselves? Sorry for noob question - little experience with github)))

@cebe
Copy link
Member

cebe commented Oct 13, 2013

We should create a pull request for phpspec/php-diff and require the fixed version in composer.

@ghost ghost assigned cebe Oct 13, 2013
@cebe
Copy link
Member

cebe commented Oct 13, 2013

Well seems like the repo is not maintained very well. in the original repo https://github.com/chrisboulton/php-diff there is alrey a pull request regarding php 5.5 compatibility open for long time. Looks like it would be best to create our own fork and maintain these things on our own.

@samdark
Copy link
Member

samdark commented Oct 13, 2013

Worth trying to contact maintainer via email or IM.

@crtlib
Copy link
Contributor Author

crtlib commented Oct 13, 2013

everzet? you're his habramate, you're closer to him to do it)

@samdark
Copy link
Member

samdark commented Oct 14, 2013

@crtlib he's not code maintainer.

I'll handle the conversation.

@samdark
Copy link
Member

samdark commented Oct 14, 2013

Nothing from original author so far. @crtlib seems to be right about the fact that composer package points to a fork https://github.com/phpspec/php-diff/ Will ask everzet then.

@samdark
Copy link
Member

samdark commented Oct 15, 2013

phpspec/php-diff#2

@crtlib
Copy link
Contributor Author

crtlib commented Oct 15, 2013

I think it's a wrong commit. The callback should accept parameter $matches. If you insist on avoiding anonymous function then we should modify fixSpaces:

public static function fixSpaces($matches)
{
    $spaces = isset($matches[1]) ? $matches[1] : '';
    $count = strlen($spaces);
    if($count == 0) {

But still I think that it'd be better to use backreference as close as possible to the regular expression itself. Just as in my snippet at the beginning.

@cebe
Copy link
Member

cebe commented Oct 15, 2013

Please move discussion about the actual pull request to there so maintainer can see it and take part in discussion.

@samdark
Copy link
Member

samdark commented Oct 15, 2013

@crtlib fixed. Thanks. The usage of static method is not to bump library requirements to 5.3. If there are more to discuss, let's do it in that pull request as @cebe suggested.

@crtlib
Copy link
Contributor Author

crtlib commented Oct 15, 2013

Now I see. Thanks for explaining. I have nothing more to add)))

@ghost ghost assigned samdark Oct 31, 2013
@samdark
Copy link
Member

samdark commented Nov 1, 2013

Changes merged to phpspec repo. Closing.

@samdark samdark closed this as completed Nov 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants