Syntax error unexpected t_object_operator

New Page

Support » Plugin:Ninja Forms Contact Form – Drag and Drop Form Builder for WordPress » Parse Error: Syntax error, ‘->’ unexpected (T_OBJECT_OPERATOR)

Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR)

  • Solved 248a426bc0ce48f180aa13789937d375marcusr44

    (@marcusr44)

    10 months ago

    Hi,

    Hoping you can help. We just updated the Ninja Forms plugin to the latest update and the site stopped working. I renamed the file to disable the plugin so I could see the error. The error displayed is:

    Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR) in /home/composi5/public_html/wp-content/plugins/ninja-forms/includes/Routes/Submissions.php at line 716

    Any idea what I can do to fix this problem please?

    Thanks.

    The page I need help with: [log in to view link]

Showing 5 answers – 1 to 5 (of 5 total)

  • 27a9cf0368a4376a371ae3cf9c911e07remanuel92

    (@renemanuel92)

    10 months ago

    I have the same problem, I actually had to deactivate the plugin

    0aad91cb996504b0761c26c28ca0a64cHinsert

    (@insert)

    10 months ago

    I had the same problem, the plugin was disabled.

    The solution was to update the PHP version from 5.6 to 7.3. I was then able to re-enable the plugin and everything is working fine now.

    Plugin Contributor a0ffd26e75f76e5bb4cc46ddee5a08ebJustin McElhaney

    (@jmcelhaney)

    9 months, 2 weeks ago

    @ marcusr44 @ renemanuel92 Je suis désolé pour le dérangement. @hinsert a raison. Pouvez-vous mettre à jour votre version PHP vers au moins PHP 7.2 et nous faire savoir si vous rencontrez toujours le même problème. WordPress recommande PHP 7.4 ou version ultérieure. https://wordpress.org/about/requirements/

    70df2f4fca85fe6fd480ddbee3e163b1ericksonstudio

    (@ericksonstudio)

    9 months, 2 weeks ago

    Esto también sucede en PHP 7.4 y 8.0:

    Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR) in /(path)/wp-content/plugins/ninja-forms/includes/Routes/Submissions.php on line 717

    • Esta respuesta fue modificada hace 9 meses, 2 semanas por .70df2f4fca85fe6fd480ddbee3e163b1ericksonstudio

    067c49999a5399914ce0a5888c359cdfgrodanBoll

    (@grodanboll)

    8 months, 3 weeks ago

    ok, para que version sirve? Necesito actualizar, pero quiero saber en qué versión comienzan a funcionar los formularios ninja.

Viendo 5 respuestas – 1 to 5 (of 5 in total)

  • The debate ‘Error of análisis: error of syntax, unexpected ‘->’ (T_OBJECT_OPERATOR)’ is cerrado y no admite más respuestas.

mrobot21

MrRobot21 OP

Posted 5 years ago

syntax error, inesperado ‘->’ (T_OBJECT_OPERATOR), esperando ‘]’

hola nice guy

I was taking the Laracast API course

I get the following error

Copy the FatalErrorException code in LessonsController.php line 19: syntax error, ‘->’ unexpected (T_OBJECT_OPERATOR), expect ‘]’

my controller is

Copy the code <?php namespace App\Http\Controllers; use App\lesson; use Response; use Illuminate\Http\Request; class LessonsController extend Controller { //get everything and pass ‘data’ metadata public function index() { $lessons = Lesson::all(); return Response ::json([ ‘data’ => this->transform($lessons) ], 200); } //get by id public function show($id) { $lesson = Lesson::find($id); if(! $lesson) { return Response::json([ ‘error’ => [ ‘message’ => ‘No response, please try again’ ] ], 404); } return Response::json([ ‘data’ => $lesson->toArray() ], 200); } //transform lessons data and return only required fields public function transform($lessons) { return array_map(function($lesson) { return [ ‘title’ => $lesson[‘title’], ‘body’ => $lesson[‘body’], ‘avtive’ => $lesson[‘completed’], ]; }, $lessons->toArray()); } }

Thanks

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Ask

Asked 9 years, 10 months ago

Modified 1 year, 11 months ago

viewed 100k times

This question shows research effort; it is useful and clear

52

This question shows no research effort; it’s not clear or not helpful

9

Bookmark this question.

View activity on this post.

I got this error while debugging my code:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in order.php at line 72

Here is a snippet of the code (starting at line 72):

$purchaseOrder = new PurchaseOrderFactory->instance(); $arrOrderDetails = $purchaseOrder->load($customerName);

  • php

Compare

Share a link to this question

Copy link CC BY-SA 3.0

Follow

Follow this question to receive notifications

modified on August 6, 2017 at 7:21 PM

Restore Monica's user avatar3167040

Restate Monica3167040

684 9 9 silver badges 23 23 bronze badges

requestedNovember 14, 2012 at 10:33 PM

User avatar of user1825110

user1825110 user1825110

535 1 1 gold badge 5 5 silver badges 6 6 bronze badges

0

Add a comment | 

3 answers3

Sorted by: Reset to default

High score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

This answer is helpful

88

This answer is not helpful

View activity on this post.

Unfortunately, it is not possible to call a method on a newly created object before PHP 5.4.

In PHP 5.4 and later, the following can be used:

$purchaseOrder = (new PurchaseOrderFactory)->instance();

Note the required pair of parentheses.

In earlier versions, you must call the method on a variable:

$purchaseFactory = new PurchaseOrderFactory; $purchaseOrder = $purchaseFactory->instance();

Compare

Share a link to this answer

Copy link CC BY-SA 4.0

Follow

Follow this answer to receive notifications

modified on March 6, 2020 at 1:27 PM

answeredNovember 14, 2012 at 10:36 PM

SirDarius user avatar

SirDarius SirDarius

39.8k 8 8 gold badges 84 84 silver badges 99 99 bronze badges

1

  • of them

    Even if he used his code on PHP 5.4 it would generate a syntax error.

    – Muntachir Akon

    October 15, 2015 at 1:48 PM

Add a comment | 

This answer is helpful

3

This answer is not helpful

View activity on this post.

replace with since your syntax is invalid:

$purchaseOrder = PurchaseOrderFactory::instance(); $arrOrderDetails = $purchaseOrder->load($customerName);

where presumably instance() creates an instance of the class. You can do this instead of saying new

Compare

Share a link to this answer

Copy link CC BY-SA 3.0

Follow

Follow this answer to receive notifications

answeredNovember 14, 2012 at 10:34 PM

User avatar of Samuel Cook

Samuel CookSamuel Cook

16.2k 6 6 gold badges 48 48 silver badges 61 61 bronze badges

1

  • this code works for php version 4.9. But why does this error occur?

    – Madhourya Gandi

    June 5, 2017 at 9:09 PM

Add a comment | 

This answer is helpful

1

This answer is not helpful

View activity on this post.

You cannot use (this is invalid php syntax):

newPurchaseOrderFactory->instance();

You probably meant one of these:

// Initialize the new object of class PurchaseOrderFactory new PurchaseOrderFactory(); // Clone instance of existing PurchaseOrderFactory clone PurchaseOrderFactory::instance(); // Just use an instance PurchaseOrderFactory::instance(); // Initialize the new object and use one of its methods $tmp = new PurchaseOrderFactory(); $tmp->instance();

Compare

Share a link to this answer

Copy link CC BY-SA 3.0

Follow

Sigue esta respuesta para recibir notifications

answered Nov 14, 2012 at 10:35 PM

Vyktor user avatar

Vyktor Vyktor

20.1k 5 5 gold badges 59 59 silver badges 95 95 bronze badges

Add a comment | 

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Not the answer you’re looking for? Browse other questions tagged

  • php

or ask your own question.

  • El blog de desbordamiento
  • Tiempo de actividad de cinco nueves sin desgaste del revelador (Ep. 488)

  • Odiamos Scrum y Agile… cuando se hace mal (Ep. 489)

  • Destacado en Meta
  • Cambios recientes de contraste de color y actualizaciones de accesibilidad

  • ¿Debo explicar las respuestas de solo código de otras personas?

  • Réviseur par-dessus bord ! Ou une demande d’amélioration du guide d’intégration pour les nouveaux…

  • Mise à jour collective : membres reconnus, articles et GitLab

Bondir

0

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in mail.php at line 4

0

Payload Object T Operator Error

1

Laravel Abstract Class Repository

0

Facebook Login PHP SDK 4.4

0

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expects ‘)’

1

syntax error, unexpected T_OBJECT_OPERATOR? Facebook

1

CakePHP 3 showing blank white page

1

php – class DbQuery() and T_OBJECT_OPERATOR

-1

Partial amount of PHP visible on the web page

Related

2773

How can I prevent SQL injection in PHP?

2937

Removing an element from an array in PHP

2267

How do you parse and process HTML/XML in PHP?

4961

Reference — What does this symbol mean in PHP?

2229

How does PHP ‘foreach’ actually work?

1251

Reference – What does this error mean in PHP?

2673

Why shouldn’t I use mysql_* functions in PHP?

193

In PHP, why doesn’t </script> show a parse error?

298

What does yield mean in PHP?

752

PHP parsing/syntax errors; and how to solve them

burning questions from the net

  • Does scintillating spell metamagic apply to minor spells (e.g. Lightning Arc)?
  • Has Batman ever been produced as an Arkham fan theory inmate in any medium?
  • Is the fake ice cream on top of an ice cream truck called an “ice cream figure”?
  • Can prisoners of war be exchanged against their will?
  • Non-transport factors
  • Can Congress enforce an overturned Supreme Court decision?
  • “Every Saturday and Sunday”? What is it about?
  • Are there any countries in Europe where there is a numerical threshold of 10% (or similar, but low) for minority language rights?
  • In which chamber of the United States Congress is a bill introduced first?
  • How to fill a plot area with angled lines without using HatchFilling?
  • Alice’s restaurant benefits allergy sufferers
  • What is the area of ​​the SSME nozzle knowing only thrust at sea level and in a vacuum?
  • How can we extract potassium fluoride from the Earth?
  • Which is stronger: an ability that can be used during skill bonus periods or one that can be used once per short rest?
  • TV show/movie where a group of children are taken from one universe/planet to another; they end up in a huge playroom and are toys for a giant’s son
  • Solve a 5×5 pentomino with only certain shapes
  • When is it really worth converting RGB to CMYK (if printers do it anyway!)
  • Join with comma separated values ​​in SQL without direct relationship between tables
  • Is there a strong correlation between credit rating and mortgage rate in the United States?
  • What is this component? White SMD part marked “W”
  • Torch-like swapping for arrays?
  • Stacking: Use training or testing predictions to build features for the Tier 1 classifier
  • Translation of a line in a poem
  • How to breed the Lilim for real?

hotter questions

question flow

Subscribe to RSS

question flow

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


Video Syntax error unexpected t_object_operator

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…