Skip to content
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

PHP split() function deprecated #2940

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

PHP split() function deprecated #2940

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working Client interfaces normal

Comments

@monetdb-team
Copy link

Date: 2011-12-06 12:29:35 +0100
From: manuela <<m.sagona>>
To: clients devs <>
Version: 11.3.3 (Apr2011-SP1) [obsolete]

Last updated: 2012-01-26 15:32:08 +0100

Comment 16590

Date: 2011-12-06 12:29:35 +0100
From: manuela <<m.sagona>>

User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
Build Identifier:

PHP split() function is deprecated, but php_mapi.inc does a large use of it

Reproducible: Always

Comment 16598

Date: 2011-12-06 13:33:26 +0100
From: @grobian

All our split usage is non-pattern wise, so we can use explode, like the patch below. Would you mind testing if that works correctly?

diff --git a/clients/php/lib/php_mapi.inc b/clients/php/lib/php_mapi.inc
--- a/clients/php/lib/php_mapi.inc
+++ b/clients/php/lib/php_mapi.inc
@@ -163,12 +163,12 @@
if ($row[1] == Q_TABLE) {
$operation = Q_TABLE;
// save info about the query

  •                                   $fields = split(" ", $row);
    
  •                                   $fields = explode(" ", $row);
                                      $handle["query"] = array("id" => $fields[1], "rows" => $fields[2], "cols" => $fields[3], "index" => $fields[4]);
    
                              } else if ($row[1] == Q_UPDATE) {
                                      $operation = Q_UPDATE;
    
  •                                   $fields = split(" ", $row);
    
  •                                   $fields = explode(" ", $row);
                                      $handle["query"] = array("affected" => $fields[1]);
                              } else if ($row[1] == Q_CREATE) {
                                      $operation = Q_CREATE;
    

@@ -222,13 +222,13 @@
//$parsed_rows = "";

             $rows = rtrim($rows, "\t]");
  •           return split("\t]", $rows);
    
  •           return explode("\t]", $rows);
    

// print_r($parsed_rows);
/*
foreach ($rows as &$row) {

                     $row = ltrim($row, "[ ");
  •                   $row = split(",\t",  $row);
    
  •                   $row = explode(",\t",  $row);
    
                      foreach ($row as &$field) {
                              $field = stripslashes($field);
    

@@ -244,7 +244,7 @@

     function php_parse_row($row) {
             $row = ltrim($row, "[ ");
  •           $row = split(",\t",  $row);
    
  •           $row = explode(",\t",  $row);
              foreach ($row as &$field) {
                      if ($field == "NULL") {
                              $field = NULL;
    

@@ -269,12 +269,12 @@

             /* Field names */
             $header[1] = ltrim($header[1], "% ");
  •           $header[1] = split("", $header[1]);
    
  •           $header[1] = explode("", $header[1]);
              $header_array["fields"] = explode(",\t", $header[1][0]);
    
              /* Field types */
              $header[2] = ltrim($header[2], "% ");
    
  •           $header[2] = split("", $header[2]);
    
  •           $header[2] = explode("", $header[2]);
              $header_array["types"] = explode(",\t", $header[2][0]);
    
              return $header_array;
    

@@ -328,7 +328,7 @@
)

             */
  •           $credentials = split(":", $challenge);
    
  •           $credentials = explode(":", $challenge);
              $algos = explode(',', $credentials[3]);
    

@@ -352,7 +352,7 @@
if ($response != MSG_PROMPT) {
// not ready to authenticate yet
if ($response[0] == MSG_REDIRECT) {

  •                           $redirects = split("\n", $response);
    
  •                           $redirects = explode("\n", $response);
                              /* Follow the first redirect */
    
                              if ( ($redirects[0] == "") || (substr($redirects[0], 0, 6) != "^mapi:") ) {
    

Comment 16628

Date: 2011-12-08 14:16:05 +0100
From: @grobian

Changeset 2af65b58ba4b made by Fabian Groffen fabian@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=2af65b58ba4b

Changeset description:

php_mapi: use explode instead of deprecated split

Bug #2940: drop deprecated split() usage.

Comment 16629

Date: 2011-12-08 14:16:35 +0100
From: @grobian

local testing showed no problems, committed.

Comment 16835

Date: 2012-01-26 15:32:08 +0100
From: @sjoerdmullender

The Dec2011 version has been release, so declaring this bug as FIXED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client interfaces normal
Projects
None yet
Development

No branches or pull requests

2 participants