Jump to content

Update 2.7.3 to 3.0.8 - ProcessWire::getArray does not exist...


SteveB
 Share

Recommended Posts

My local server was running 2.6.21. I installed the ProcessWireUpgrade and updated to 2.7.3 very smoothly. Everything seemed fine.

Next, I had it download 3.0.8, it said my .htaccess and index.php were compatible. The "Upgrade completed" message appeared. I checked a couple pages and each time I get:

Fatal error: Exception: Method ProcessWire::getArray does not exist or is not callable in this context (in /web/elastic/demo26b/wire/core/Wire.php line 347) #0 [internal function]: ProcessWire\Wire->___callUnknown('getArray', Array) #1 /web/elastic/demo26b/wire/core/Wire.php(303): call_user_func_array(Array, Array) #2 /web/elastic/demo26b/wire/core/WireHooks.php(555): ProcessWire\Wire->_callMethod('___callUnknown', Array) #3 /web/elastic/demo26b/wire/core/Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessWire), 'callUnknown', Array) #4 /web/elastic/demo26b/wire/core/ProcessWire.php(471): ProcessWire\Wire->__call('callUnknown', Array) #5 /web/elastic/demo26b/wire/core/Wire.php(328): ProcessWire\ProcessWire->__call('callUnknown', Array) #6 /web/elastic/demo26b/wire/core/Wire.php(328): ProcessWire\ProcessWire->callUnknown('getArray', Array) #7 /web/elastic/demo26b/wire/core/ProcessWire.php(474): ProcessWire\Wire->__call('getArray', Array) #8 /web/elastic/demo26b/site/assets/cache/FileCompiler/site/mod in /web/elastic/demo26b/index.php on line 64

Some issue with the file compiler??

Reverting to 2.7.2 by swapping back in the old files worked fine. By the way nice job on the ProcessWireUpgrade module's messages and instructions.

Link to comment
Share on other sites

My local server was running 2.6.21. I installed the ProcessWireUpgrade and updated to 2.7.3 very smoothly. Everything seemed fine.

Next, I had it download 3.0.8, it said my .htaccess and index.php were compatible. The "Upgrade completed" message appeared. I checked a couple pages and each time I get:

What happens if you also update the .htaccess and index.php files, regardless of what it tells you?

Link to comment
Share on other sites

Here's another clue. I'm using Spex with a fresh install of 3.0.8.

spex.module has this:

     public function getTemplateVars($include_fuel=true)
     {
          return array_merge(
               $include_fuel ? fuel()->getArray() : array(),
               array('spex' => $this),
               array('slots' => $this->slots),
               $this->templateVars
          );
     }

Is that way of using "fuel" no longer supported? What should it be? Am I on the right track or is this a red herring.

Error: Exception: Method ProcessWire::getArray does not exist or is not callable in this context (in /web/elastic/demo/wire/core/Wire.php line 347)

#0 [internal function]: ProcessWire\Wire->___callUnknown('getArray', Array)
#1 /web/elastic/demo/wire/core/Wire.php(303): call_user_func_array(Array, Array)
#2 /web/elastic/demo/wire/core/WireHooks.php(555): ProcessWire\Wire->_callMethod('___callUnknown', Array)
#3 /web/elastic/demo/wire/core/Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessWire), 'callUnknown', Array)
#4 /web/elastic/demo/wire/core/ProcessWire.php(471): ProcessWire\Wire->__call('callUnknown', Array)
#5 /web/elastic/demo/wire/core/Wire.php(328): ProcessWire\ProcessWire->__call('callUnknown', Array)
#6 /web/elastic/demo/wire/core/Wire.php(328): ProcessWire\ProcessWire->callUnknown('getArray', Array)
#7 /web/elastic/demo/wire/core/ProcessWire.php(474): ProcessWire\Wire->__call('getArray', Array)
#8 /web/elastic/demo/site/modules/Spex/Spex.module(250):

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

  • Like 1
Link to comment
Share on other sites

Good thought but no luck. I was just reading up on the compiling and namespaces. Mostly in Ryan's blog posts.

So far I'm still stuck at that same spot. Could try reverting to what I used to do before Spex but that would be a time consuming rewrite.

Might be best to linger on 2.7.3 a while but wanted to make the jump now because I'm at a good spot for that otherwise.

Wondering, do I have to put namespace markup in all the little files for partials and stuff that Spex uses?

  • Like 1
Link to comment
Share on other sites

For me it is not working too.

I have prefixed all files with namespace ProcessWire, but getting the same error:

Method ProcessWire::getArray does not exist or is not callable in this context (in .../wire/core/Wire.php line 347)

Link to comment
Share on other sites

Replace 'fuel()->getArray()' with 'wire()->getArray()' and it should work. fuel() is already marked as deprecated for a good amount of time. 

For me, this doesn't change anything. I have added the namespace ProcessWire to all files that belong to Spex and all my template files too. The error persists.

Here are the call stack of my debugger. The relevant lines are 11, 10, 9, 8. As you can see, at runtime it is translated / called ProcessWire\ProcessWire->getArray(). Is this right in regard what we should expect here?

index.php(62)	Exception: Method ProcessWire::getArray does not exist or is not callable in this context
                (in ...\pw3\wire\core\Wire.php line 347)

	 #0 [internal function]: ProcessWire\Wire->___callUnknown('getArray', Array)
	 #1 ...\pw3\wire\core\Wire.php(303): call_user_func_array(Array, Array)
	 #2 ...\pw3\wire\core\WireHooks.php(555): ProcessWire\Wire->_callMethod('___callUnknown', Array)
	 #3 ...\pw3\wire\core\Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessWire), 'callUnknown', Array)
	 #4 ...\pw3\wire\core\ProcessWire.php(471): ProcessWire\Wire->__call('callUnknown', Array)
	 #5 ...\pw3\wire\core\Wire.php(328): ProcessWire\ProcessWire->__call('callUnknown', Array)
	 #6 ...\pw3\wire\core\Wire.php(328): ProcessWire\ProcessWire->callUnknown('getArray', Array)
	 #7 ...\pw3\wire\core\ProcessWire.php(474): ProcessWire\Wire->__call('getArray', Array)

*	 #8 ...\pw30\site\modules\Spex\Spex.module(250): ProcessWire\ProcessWire->__call('getArray', Array)
*	 #9 ...\pw30\site\modules\Spex\Spex.module(250): ProcessWire\ProcessWire->getArray()

*	#10 ...\pw30\site\modules\Spex\Spex.module(155): ProcessWire\Spex->getTemplateVars()
*	#11 ...\pw3\wire\core\WireHooks.php(626): ProcessWire\Spex->templateFileRenderBefore(Object(ProcessWire\HookEvent))

	#12 ...\pw3\wire\core\Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
	#13 ...\pw3\wire\modules\PageRender.module(500): ProcessWire\Wire->__call('render', Array)
	#14 ...\pw3\wire\modules\PageRender.module(500): ProcessWire\TemplateFile->render()

	#15 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
	#16 ...\pw3\wire\core\Wire.php(303): call_user_func_array(Array, Array)
	#17 ...\pw3\wire\core\WireHooks.php(555): ProcessWire\Wire->_callMethod('___renderPage', Array)
	#18 ...\pw3\wire\core\Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array)
	#19 ...\pw3\wire\core\WireHooks.php(626): ProcessWire\Wire->__call('renderPage', Array)
	#20 ...\pw3\wire\core\WireHooks.php(626): ProcessWire\PageRender->renderPage(Object(ProcessWire\HookEvent))
	#21 ...\pw3\wire\core\Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array)
	#22 ...\pw3\wire\modules\Process\ProcessPageView.module(205): ProcessWire\Wire->__call('render', Array)
	#23 ...\pw3\wire\modules\Process\ProcessPageView.module(205): ProcessWire\Page->render()

	#24 [internal function]: ProcessWire\ProcessPageView->___execute(true)
	#25 ...\pw3\wire\core\Wire.php(303): call_user_func_array(Array, Array)
	#26 ...\pw3\wire\core\WireHooks.php(555): ProcessWire\Wire->_callMethod('___execute', Array)
	#27 ...\pw3\wire\core\Wire.php(327): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array)
	#28 ...\pw3\index.php(53): ProcessWire\Wire->__call('execute', Array)
	
        #29 ...\pw3\index.php(53): ProcessWire\ProcessPageView->execute(true)
	#30 {main}	E_USER_ERROR

Spex.module has:

<?php namespace ProcessWire;
	public function getTemplateVars($include_fuel=true)
	{
		return array_merge(
			$include_fuel ? wire()->getArray() : array(), // should be: $include_fuel ? wire('all')->getArray() : array(), !!
			array('spex' => $this),
			array('slots' => $this->slots),
			$this->templateVars
		);
	}
Link to comment
Share on other sites

Ah, sry wire('all')->toArray() or wire('*')->toArray() will get you the part you want. Might be because of the changes to the wire() function call to allow for multi instance.

I've just looked into the 2.7 core files and the keys 'all' and '*' are also present there. I'm not sure for how long these are supposed to be used as replacement for fuel() calls. 

  • Like 3
Link to comment
Share on other sites

Ah, sry wire('all')->toArray() or wire('*')->toArray() will get you the part you want. Might be because of the changes to the wire() function call to allow for multi instance.

I've just looked into the 2.7 core files and the keys 'all' and '*' are also present there. I'm not sure for how long these are supposed to be used as replacement for fuel() calls. 

Hah! It's working now with using

			$include_fuel ? wire('all')->getArray() : array(),

Thanks, @Lostkobrakai! You made me happy! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...