php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77786 set_local_infile_handler and set_local_infile_default methods of MySQLi
Submitted: 2019-03-23 17:38 UTC Modified: 2020-12-11 21:59 UTC
From: museyib dot e at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 7.3.3 OS: Kali kali-rolling (x86-64)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: museyib dot e at gmail dot com
New email:
PHP Version: OS:

 

 [2019-03-23 17:38 UTC] museyib dot e at gmail dot com
Description:
------------
---
From manual page: https://php.net/mysqli.set-local-infile-handler
---
An error occurs at the methods "set_local_infile_handler" and "set_local_infile_default" of MySQLi class. Even the code sample in PHP documentation does not work.

Test script:
---------------
<?php
  $db = mysqli_init();
  $db->real_connect("localhost","root","","test");
  function callme($stream, &$buffer, $buflen, &$errmsg) {
    $buffer = fgets($stream);
    echo $buffer;
    $buffer = strtoupper(str_replace(",", "\t", $buffer));
    return strlen($buffer);
  }
  echo "Input:\n";
  $db->set_local_infile_handler("callme");
  $db->query("LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
  $db->set_local_infile_default();
  $res = $db->query("SELECT * FROM t1");
  echo "\nResult:\n";
  while ($row = $res->fetch_assoc()) {
    echo join(",", $row)."\n";
  }
?>


Expected result:
----------------
I expect that code will work successfully? it doesn't matter what resalt is.

Actual result:
--------------
But this error appears:

 Fatal error: Uncaught Error: Call to undefined method mysqli::set_local_infile_handler()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-24 18:04 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2019-03-24 18:04 UTC] cmb@php.net
These methods (and the corresponding functions) have been
removed[1], but the docs have not been updated accordingly.  Also,
it has been overlooked to remove the declarations[2].

[1] <http://git.php.net/?p=php-src.git;a=commit;h=522595086b8d654a2fd954977f7f443f2578de22>
[2] <https://github.com/php/php-src/blob/php-7.3.4RC1/ext/mysqli/mysqli_fe.h#L71-L72>
 [2019-05-02 12:20 UTC] vharihar at gmail dot com
Is there a replacement function?

This seems to be a useful function to have.
 [2020-12-11 21:59 UTC] dharman@php.net
-Status: Verified +Status: Not a bug
 [2020-12-11 21:59 UTC] dharman@php.net
I am closing this bug report as it is not a bug. These functions have been removed from PHP 5.5 back in 2012. The documentation part was missed, but now all PHP 5 documentation has been archived anyway. The function definition file is now obsolete too.
The only alternative is what Andrey suggested in 2012 (stream handlers), but I have never tested it. If you got it to work, you can paste a solution here in case anyone else tries to find a workaround for it too.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC