Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Help Needed. Service Unavailable - Uncaught Exception Rate Topic   - - - - -

 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 12 February 2018 - 04:50 PM #1

We are randomly and intermittently getting the following error on our home page using cs-cart 4.5.2SP2.

 

Any suggestions?  I have no idea what Pimple is or what it is used for.  Refreshing the page [F5] always gets rid of the error.

 

<!--
 
PHP Fatal Error
 
Message
Uncaught exception 'InvalidArgumentException' with message 'Identifier "view" is not defined.' in /home/homescho/public_html/app/lib/vendor/pimple/pimple/src/Pimple/Container.php:95
Stack trace:
#0 /home/homescho/public_html/app/Tygh/Registry.php(104): Pimple\Container->offsetGet('view')
#1 /home/homescho/public_html/app/functions/fn.cart.php(3340): Tygh\Registry::get('view')
#2 /home/homescho/public_html/app/functions/fn.cart.php(1661): fn_calculate_cart_content(Array, Array, 'S', false, 'I', false)
#3 /home/homescho/public_html/app/functions/fn.users.php(1354): fn_extract_cart_content(Array, '2', 'C')
#4 /home/homescho/public_html/app/functions/fn.users.php(2523): fn_init_user_session_data(Object(Tygh\Web\Session), '2')
#5 /home/homescho/public_html/app/functions/fn.init.php(590): fn_login_user('2')
#6 [internal function]: fn_init_user()
#7 /home/homescho/public_html/app/functions/fn.init.php(996): call_user_func_array('fn_init_user', Array)
#8 /home/homescho/public_html/init.php(150): fn_init(Array)
#9 /ho
 
Error at
app/lib/vendor/pimple/pimple/src/Pimple/Container.php, line: 95
 
Backtrace
 

--> 



 
  • martfox
  • Member
  • Authorized Reseller
  • Join Date: 15-Jan 10
  • 552 posts

Posted 12 February 2018 - 05:23 PM #2

I have no idea what Pimple is or what it is used for.  Refreshing the page [F5] always gets rid of the error.

 

https://pimple.symfony.com/


CS-Cart with 1 Year FREE Web Hosting | CS-Cart optimized SSD Cloud VPS Servers from €10.00/month
.
VPS SSD Cloud from €10.00 *** Dedicated Servers *** CS-Cart Authorized Reseller and Web Hosting Provider


 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 387 posts

Posted 12 February 2018 - 05:56 PM #3

Hello,

 

This would require server-side investigation. Contact either the CS-Cart helpdesk or feel free to contact us at info@poppedweb.com

 

Best wishes,


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).

 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 12 February 2018 - 05:57 PM #4

Yes, I see what pimple is, but what does the error mean and how to correct? 



 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 387 posts

Posted 12 February 2018 - 05:58 PM #5

Yes, I see what pimple is, but what does the error mean and how to correct? 

 

Like I said, we can't see from here. We need to know which add-ons you have, what core modifications you have done, PHP version, etc.


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10607 posts

Posted 12 February 2018 - 08:59 PM #6

From the stack trace provided, it is trying to retrieve the current template "view" from the registry but for some reason it is undefined.

As @popedweb states, it must be investigated on your server since 1) it is intermittent (which means sometimes it works and sometimes doesn't) and 2) That is is probably NOT related to the registry at all, but rather to the template engine itself. There is probably a different error ahead of this one in your error_log that will probably point more directly to the actual problem rather than the symptom.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3606 posts

Posted 13 February 2018 - 12:17 AM #7

http://forum.cs-cart...le&fromsearch=1



 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 13 February 2018 - 12:27 AM #8

I saw that the other day and tried it. Still a NOGO. 

 

 



 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 13 February 2018 - 01:01 AM #9

OK, I think I found the cause. Now how to fix.

 

I have some modified code in fn.cart.php that says

 

if (strlen($arrive['3'])>1) {Registry::get('view')->assign('arrive3', $arrive['3']);}

 

It appears for some reason, sometimes 'view' is not defined and Registry::get('view') is throwing an error. 

 

Why?

 

and I have 

 

use Tygh\Registry;



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10607 posts

Posted 13 February 2018 - 01:50 AM #10

Generally a Registry::get('something") will return false if "something" is not set.  You can use an ifGet(value, default) but then what would you do if it's not set?

 

So the reason it's not set is most likely that you are trying to reference the 'view' before the templater is initialized (which is where the 'view' is set).  Are you doing this in an addon?  Addons init.,php files are usually run AFTER all the standard init() routines are performed.  If you're modifying distributed code then you are probably trying to reference it before the templater is initialized.

 

Suggest you verify at what point in the page loading process you are getting the 'view'.

 

To help any further, would need more detail on what/how you're doing what you are doing.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 13 February 2018 - 02:07 AM #11

Yes, I believe you are correct about the templater getting initialized, but weird how the error is very intermittent.

 

Its for an addon, but I modified the app/functions/fn.cart.php directly in order to pass some variables. It all works fine (has been for years), but very intermittently we get this view error.  

 

In fn.cart.php (around line 3325), I added:

foreach ($group['shippings'] as $shipping_id => $shipping) {
			
			
			//	if ($shipping_id == 40) {continue 1;}
			// DAVID MOD FOR ARRIVE DATE
                    //echo $shipping_id.'<br>';
                    $arrive  = arriveDate($shipping_id);  //call function and pass in $shipping_id              
                   
                    //  Assign smarty variables to PHP array indexes
                    if (strlen($arrive['3'])>1) {Registry::get('view')->assign('arrive3', $arrive['3']);}
                    if (strlen($arrive['11'])>1) {Registry::get('view')->assign('arrive11', $arrive['11']);}
                    if (strlen($arrive['12'])>1) {Registry::get('view')->assign('arrive12', $arrive['12']);}
                    if (strlen($arrive['13'])>1) {Registry::get('view')->assign('arrive13', $arrive['13']);}
                    
                    //GROUND BY ZONES
                    if (strlen($arrive['111'])>1) {Registry::get('view')->assign('zone1', $arrive['111']);}
                    if (strlen($arrive['112'])>1) {Registry::get('view')->assign('zone2', $arrive['112']);}
                    if (strlen($arrive['113'])>1) {Registry::get('view')->assign('zone3', $arrive['113']);}
                    if (strlen($arrive['114'])>1) {Registry::get('view')->assign('zone4', $arrive['114']);}
                    if (strlen($arrive['115'])>1) {Registry::get('view')->assign('zone5', $arrive['115']);}
                    
            // END DAVID MOD FOR ARRIVE DATE


 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 13 February 2018 - 02:19 AM #12

Do you see any harm (or will it help) if I add
fn_init_stack(array('fn_init_templater'));
before the foreach line of code?
 
I tried it and so far no error, but the problem is intermittent.


 
  • Triplets
  • Senior Member
  • Members
  • Join Date: 23-Sep 08
  • 1175 posts

Posted 13 February 2018 - 06:03 PM #13

Unfortunately we have seen the error once today.  So my fix didn't help.

 

It does appear to be the Admin who sees it the most when switching to Frontend. Can it be related to the Admin logging in with multiple accounts or acting on behalf of?  We are not sure if customers are seeing the intermittent error.

 

David



 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 387 posts

Posted 13 February 2018 - 06:10 PM #14

Hello,

 

The only thing I could think of is that you have created / edited an order and then decide to view the admin panel (without a user session --> sid_customer_*) thus causing this bug (because it will try and calculate the cart of the admin perhaps?).

 

Kind regards,


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10607 posts

Posted 13 February 2018 - 06:52 PM #15

I can guess till the cows come home.

Best practice would be never modify core files. Always use addons.  If you need to modify a core file, do it as a hook and then make a hook request in the developer area (sticky post).  Never do anything in an addon's config.php file that expects other areas of the system to be initialized (I.e. init follows config).


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.