php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77856 xdiff_string_patch() no $error returned
Submitted: 2019-04-05 14:05 UTC Modified: -
From: kentaro at ranvis dot com Assigned:
Status: Open Package: xdiff (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
38 - 27 = ?
Subscribe to this entry?

 
 [2019-04-05 14:05 UTC] kentaro at ranvis dot com
Description:
------------
The fourth parameter of xdiff_string_patch() $error should return failed hunks of the patch, but nothing is returned.

Will add PR later.

Test script:
---------------
<?php
$str = "123\n456\n";
$patch = "@@ -1,2 +1,3 @@\n 789\n+012\n 345\n";
$result = xdiff_string_patch($str, $patch, XDIFF_PATCH_NORMAL, $error);
var_dump($result === $str);
var_dump($error === $patch);


Expected result:
----------------
bool(true)
bool(true)


Actual result:
--------------
bool(true)
bool(false)


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-05 14:11 UTC]
The following pull request has been associated:

Patch Name: Fixed bug #77856 (xdiff_string_patch() no $error returned).
On GitHub:  https://github.com/php/pecl-text-xdiff/pull/4
Patch:      https://github.com/php/pecl-text-xdiff/pull/4.patch
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Sep 15 12:01:26 2019 UTC