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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kentaro at ranvis dot com
New email:
PHP Version: OS:

 

 [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: Tue Nov 12 14:01:31 2019 UTC