[Solved] Cannot access parent fatal error.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

[Solved] Cannot access parent fatal error.

Post by social_experiment »

I've recently come across this fatal error
Fatal error: Cannot access parent:: when current class scope has no parent in ...
I did some reading and came across this url
https://bugs.php.net/bug.php?id=56529

Has anyone else come across this bug and fixed it? Is it related to different versions of php because on my production server i didn't have this issue. From what i can gather the live server might be using Lampp where i used Xampp on my production server.

Thanks in advance
Last edited by social_experiment on Mon Sep 10, 2012 4:52 am, edited 1 time in total.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot access parent fatal error.

Post by requinix »

Using APC? Disabled it? Or tried touch-ing the file so APC rebuilds it?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Cannot access parent fatal error.

Post by social_experiment »

requinix wrote:Using APC? Disabled it? Or tried touch-ing the file so APC rebuilds it?
No idea x 3. The code in question imports a file, reads the data into an array and the removes it. The line number that came with the error is linked to this code

Code: Select all

fclose($handle);
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Cannot access parent fatal error.

Post by social_experiment »

The problem seems to be generated by the apc extension. I downloaded and installed the extension on my development server and on certain pages i get this error message (and a notice)

Fatal error: Cannot redeclare __autoload() (previously declared in C:\xampp\htdocs\***\_autoloader.php:5) in C:\xampp\htdocs\***\_autoloader.php on line 10
Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\***\_auth.php on line 2

One i've updated the php.ini file and removed the extension the above issue was resolved. I'm in the process of checking the live server to see if the acp extension is present there. My big concern now is if i remove the extension or disable it; what effect will it have on the rest of the server. Is this extension required for proper functioning of code? Also how can i go about preventing this type of thing from happening in future code?

Edit - 2012/09/06
Got additional information about the server housing the code - the apc extension isn't present on the server. The php version is 5.2.6; any ideas on what could be causing this issue?

Edit - 2012/09/10
Problem resolved. I'm not sure what went on here but i'm glad that it is now back to working order. Only problem i found was a 'Cannot redeclar _autoload()...' issue which i fixed.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply