Php fatal error: uncaught error: call to undefined function each() in

firstly I was receiving a warning and a fatal error. The warning:

Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Then I replaced the continue with break and the warning disappeared. But even after the replacement, the fatal error still happens. The fatal error:

PHP Fatal error:  Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()
#4 {main}
  thrown in D:\xampp\php\pear\PHPUnit\Util\Getopt.php on line 80

Fatal error: Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()

The line 77-83 of Getopt.php

        reset($args);
        array_map('trim', $args);

        while (list($i, $arg) = each($args)) {
            if ($arg == '') {
                continue;
            }

Im using PHP 8.0.1 and the PHPUnit 9 (at least I think, because I cant use commands to check, and I downloaded it after february 7)

Juliano

Guest

  • #1

Juliano Asks: (PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()
firstly I was receiving a warning and a fatal error. The warning:

Code:

Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Then I replaced the continue with break and the warning disappeared. But even after the replacement, the fatal error still happens. The fatal error:

Code:

PHP Fatal error:  Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()
#4 {main}
  thrown in D:\xampp\php\pear\PHPUnit\Util\Getopt.php on line 80

Fatal error: Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()

The line 77-83 of Getopt.php

Code:

        reset($args);
        array_map('trim', $args);

        while (list($i, $arg) = each($args)) {
            if ($arg == '') {
                continue;
            }

Im using PHP 8.0.1 and the PHPUnit 9 (at least I think, because I cant use commands to check, and I downloaded it after february 7)

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.

/forums/whats-new/news-feed

  • Deep Sheth
  • 14 minutes ago
  • Technology Forum
  • Replies: 0

Deep Sheth Asks: Navigation host is not showing in Navigation graph
main activity (called news activity)

Code:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.NewsActivity">

    <FrameLayout
        android:id="@+id/flFragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <fragment
            android:id="@+id/newsNavHostFragment"
            android:name="androidx.navigation.fragment.NavHostFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:defaultNavHost = "true"
            app:NavGraph="@navigation/nav_graph"/>


    </FrameLayout>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigationView"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

and mine nav_graph.xml code

Code:

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/news_nav_graph">
</navigation>

i have tried to restart and cache android studio but it didnt work. and also updated navigation dependencies to latest version..

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • kds14589
  • 14 minutes ago
  • Technology Forum
  • Replies: 0

kds14589 Asks: Cell Loses Focus When Excel VBA installed Button Clicked
I have a sub-form that focuses its answer on the active cell that was chosen. BUT, once I click on the cell/button to load/show this sub-form, my choice of the ‘active cell’ changes to the button cell and my sub-form rejects the chosen cell. I don’t have this problem if I use an ActiveX button but I’ trying to avoid them on this project. Any recommendations?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • fernando gonzalez
  • 14 minutes ago
  • Technology Forum
  • Replies: 0

fernando gonzalez Asks: Error with subscribe or inserting data between ionic and php/mysql
In the file "cargar-obra.page.ts" I have this function:

Code:

btnClickAgregarObra(){
  const datosObra = {
      num_obra: this.num_obra,
      nombre_obra: this.nombre_obra,
      dir_obra: this.dir_obra,
      muni_obra: this.muni_obra,
      costo_obra: this.costo_obra,
      fecha_ini_obra: this.fecha_ini_obra,
    }
  this.configService.cargarObra(datosObra).subscribe(res=>console.log(res));

that last line calls this code on "config.service.ts":

Code:

public cargarObra(obraData){
    console.log(obraData);
    return this.http.post('http://localhost/obras.php',obraData,{headers:{'Content-Type':'application/json'}})
  }

About that las code, I put the "console.log(obraData)" to see if the json brings the data correctly, and it does.

And the code above calls the las file "obras.php":

Code:

$body = file_get_contents("php://input");
$body2 = json_decode($body, true);

$num_obra = $body2['num_obra'];  
$nombre_obra = $body2['nombre_obra'];
$dir_obra = $body2['dir_obra'];  
$muni_obra = $body2['muni_obra']; 
$costo_obra = $body2['costo_obra']; 
$fecha_ini_obra = $body2['fecha_ini_obra']; 
$inspector_asignado = $body2['inspector_asignado']; 

$sql = "INSERT INTO `obra`(`idobra`, `idusuario`, `descripcion`, `direccion`, `localidad`, `fechainicio`, `costo`) VALUES ($num_obra, $inspector_asignado,'$nombre_obra','$dir_obra','$muni_obra','$fecha_ini_obra', $costo_obra)";

$q = mysqli_query($conn, $sql);
die();

What could be happening? Thanks to all help.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Hextav
  • 14 minutes ago
  • Technology Forum
  • Replies: 0

Hextav Asks: Can I make a VR game with python?
I know python isn't a viable option for VR game development, but I hope there's a way to create a 3D game in it.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Husker
  • 14 minutes ago
  • Technology Forum
  • Replies: 0

Husker Asks: Memory leak when creating matplotlib.plots in loops
I know it was discussed not only once. Unfortunately, I do not get further.

first the basic: I am trying to loop through OHLC data and create charts. Unfortunately the memory keeps running full.

Apparently it has something to do with the size of the chart.

Code:

plt.ioff()
fig = plt.figure(figsize=(50, 25))

for line in ohlc_data:

   # Make magic with the data
   # ...

   df = x.get_ohlc_data()
   ohlc_area = plt.subplot2grid((6, 3), (0, 0), colspan=3, rowspan=4)
   ohlc_area.plot(df[['Date']], df[['close']], 'k-', markevery=markers_on, marker='D',
                                                       label='close')
   plt.grid(axis='x', color='0.95')
   plt.grid(axis='y', color='0.95')
   plt.savefig("Diagramme/" + str(x.id) + "_" + x.state + ".png")

   # Try to clean up everything
   fig.clf()
   plt.cla()
   plt.clf()
   plt.close('all')
   gc.collect()

Up to this point it works. Unfortunately fig.clf() also resets the size of the diagram. If I try to resize the diagram within the loop, there is a memory leak and I don't understand why.

Code:

plt.ioff()
fig = plt.figure(figsize=(50, 25))

for line in ohlc_data:

   # Make magic with the data
   # ...

   #plt.figure(figsize=(50, 25))
   plt.rcParams["figure.figsize"] = (50, 25)
   #fig = plt.figure(figsize=(50, 25))

   df = x.get_ohlc_data()
   ohlc_area = plt.subplot2grid((6, 3), (0, 0), colspan=3, rowspan=4)
   ohlc_area.plot(df[['Date']], df[['close']], 'k-', markevery=markers_on, marker='D',
                                                       label='close')
   plt.grid(axis='x', color='0.95')
   plt.grid(axis='y', color='0.95')
   plt.savefig("Diagramme/" + str(x.id) + "_" + x.state + ".png")

   # Try to clean up everything
   fig.clf()
   plt.cla()
   plt.clf()
   plt.close('all')
   gc.collect()

I tried at the beginning of the loop with:

Code:

   #plt.figure(figsize=(50, 25))
   plt.rcParams["figure.figsize"] = (50, 25)
   #fig = plt.figure(figsize=(50, 25))

Unfortunately it does not work, can someone tell me how I can prevent the memory increase or how this problem comes about?

Thanks in advance

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.