Midnight Modding Posted August 15, 2018 Posted August 15, 2018 For quite a while I have noticed, on and off, just when being anywhere on my site, I get an exception saying my class could not be loaded. This is not within my app. So what types of things are done in 4.x, that could be done anywhere in the forums, and be trying to load my class? A task, I am assuming? In the exception message it looks like my class is named properly and it's the same class successfully loaded throughout my app. I actually haven't evenb added tasks yet.... so all I can think of is some extension, but whatever it is, it's something that only does this occasionally. I think in the message it said IPS\. Maybe somewhere I needed to put \IPS\ and didn't put that first \. ps it always goes away when reloading the page. so it's a 1 time thing then doesn't happen again for days.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 Apparently you didn't read the post. I immediately said what the error is (it says the class can't be loaded) and the entire question is which files could be causing that on the board index, so Kind of hard to "show my code" when I have no idea which file is causing it. Again, the question is which types of activities could IPB be trying to do on the board index that would be related to third party apps? I can't think of anything. Like I said, I have added no tasks and I can't think of extensions that would be executed on the board index. And this only rarely happens. It said to be sure I have named my class with an underscore etc etc and this is for the same class I have already used all throughout my app with no issue.
Nathan Explosion Posted August 15, 2018 Posted August 15, 2018 2 minutes ago, Midnight Modding said: Apparently you didn't read the post. I wish I hadn't, but as someone who would like to help I did. I will definitely not be doing so again....done. I'm out.
Adriano Faria Posted August 15, 2018 Posted August 15, 2018 5 hours ago, Midnight Modding said: I get an exception saying my class could not be loaded This is the error @Nathan Explosion talked about. If you got an exception, you got an error with a backtrace. As we don’t have crystal ball, posting the error MIGHT make someone be interested in your issue, otherwise it will be another topic with 8237636 replies of you with 2883837346 edita in every post.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 Out of habit, I just reloaded the page because the error is always gone when I do so. I did glance at that backtrace, though and clicked on them all and they didn't change what data was to the right and also none were my file names, but I didn't look closely at them. In content routers I see the following: public $classes = array(); In MY content router I have my class name in that array. Could that be the problem? I must have seen it done somewhere else or I doubt I would have done it that way. Like I said, it's an issue that happens only rarely. Like once per week or something. Maybe some built in IPB task that is run every so often for all apps?
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 @Adriano Fariawhat are all possibilities you can think of that IPB would do on the board index for a third party app? I added nothing to do anything on the board index, so that should have it narrowed down greatly. Again, I can't post more about the error when I have no idea how to reproduce it. That is why I asked which types of things woud be done automatically, even when not inside our apps. I doubt it's from a notification... because it would do it every page load. All it said was something like "the class ips\appname\Something could not be loaded. check to be sure you used an underscore in the class name and put it in the proper namespace". Something like that...
Adriano Faria Posted August 15, 2018 Posted August 15, 2018 If you have a content router extension with that empty array, it’s wrong. Your content item should be there. Take a look in any IPS app. If you don’t have a content item, then remove the extension.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 39 minutes ago, Adriano Faria said: If you have a content router extension with that empty array, it’s wrong. Your content item should be there. Take a look in any IPS app. If you don’t have a content item, then remove the extension. I do have my content item in it. Where I showed you that empty array from is all of the IPS ones. I looked in dev files for topics, gallery, etc... and none have anything in that array. In mine I do have my class name in it.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 /** * Constructor * * @param \IPS\Member|IPS\Member\Group|NULL $member If checking access, the member/group to check for, or NULL to not check access * @return void */ public function __construct( $member = NULL ) { if ( $member === NULL or $member->canAccessModule( \IPS\Application\Module::get( 'forums', 'forums', 'front' ) ) ) { $this->classes[] = 'IPS\forums\Topic'; } } that is why. it's set up in the constructor. they don't have it where the array is defined in any, it's always in the constructor.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 See I had mine in both places, for some reason. Where it defined it and in the constructor. So mine would have then had the same class in it twice. You think that was my problem? But why would it only cause an error occasionally? This was the only file I could think of, so that is why I looked through it thinking maybe it had an issue.
Adriano Faria Posted August 15, 2018 Posted August 15, 2018 1 hour ago, Midnight Modding said: All it said was something like "the class ips\appname\Something could not be loaded. check to be sure you used an underscore in the class name and put it in the proper namespace". Something like that... And is that right? You'll need Something.php on applications/appname/sources/Something/. Also: namespace IPS\appname; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * Something Model */ class _Something extends ...
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 18 minutes ago, Adriano Faria said: And is that right? You'll need Something.php on applications/appname/sources/Something/. Also: namespace IPS\appname; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * Something Model */ class _Something extends ... yes, as I said, the class that it said couldn't be loaded is my main content item class, which is loaded just fine every single page of my app. I didn't notice any typo in the class name in that exception message either. This is a large app, which is completed other than bug testing. It has 33 source files, 15 controller files, 92 files related to templates for the skin and/or notifications. I'm wayyyyyy beyond setting up node and item classes. I have tested 20+ pages in the app, now working perfectly. No problem with my classes and I am very pleased. This is just some issue that randomly happens occasionally on the board index. Doubt it could be the content router, though. I can't think of anything that would be doing on the board index.
Midnight Modding Posted August 15, 2018 Author Posted August 15, 2018 Also my notifications are all working flawlessly, both inline and email, uploads working perfectly, forms, editor, translatables, db schema all how it needs to be, tabs (other than my issue same as what headstand had), helper class, first(), permissions, embeddable, the list goes on and on. It's just impossible for it to be my class itself. It must be some typo I somehow overlooked in the exception message where it named my class... I had a bug a few weeks ago where I Iooked and looked and was stumped, only to finally realize I typed the word team as tean. ? Btw, I think every time this happened was when I was first on the site, first time in a while. That would make me normally assume task, but I have no tasks except queued ones that haven't been used yet. It's been stressful fixing bugs, but they all end up easy now that I am so comfortable with the framework. (other than I hate design stuff, but I've always hated designing…) Luckily so many people helped me or I'd be months behind probably, due to how long it takes to go through files to track things down. (especially Brandon and newbie answering for the past few months)
bfarber Posted August 15, 2018 Posted August 15, 2018 Notifications, front tab extensions, search bar, tasks - there are dozens of things that could cause this. You'll need to post the full backtrace for someone to be able to identify what is wrong. It's probably stored in the system logs in the AdminCP so you can go retrieve it from there.
Midnight Modding Posted August 16, 2018 Author Posted August 16, 2018 12 hours ago, bfarber said: Notifications, front tab extensions, search bar, tasks - there are dozens of things that could cause this. You'll need to post the full backtrace for someone to be able to identify what is wrong. It's probably stored in the system logs in the AdminCP so you can go retrieve it from there. There isn't anything in my system logs for the past 2+ weeks, but I've had a lot of uncaught exceptions since then. Does it not log them that way when IN_DEV? I haven't yet set up search. notifications wouldn't do it just occasionally, would they? I haven't added tasks. front navigation is another that wouldn't give an error only once in a blue moon, either. So not sure. I'll just have to look at files again, but it seems to me it would be something automatic, not from my own file, but who knows.
Midnight Modding Posted August 16, 2018 Author Posted August 16, 2018 I found an issue in my queue files. Could this have caused it, even though I haven't queued anything? Does it still execute them for something? \IPS\lalala\Something\::load extra \ there. Probably in all of my queue files. edit: fixed those, which was in 8 queue files in function getProgress(). Not sure how that causes it, since no tasks had been queued, as far as I know. But it most likely was the issue because I think in the exception it may have indeed put that trailing \ in the class name... Also is there anywhere to see history of background tasks? I only see a place for current ones running. The one thing I wish would be improved is ease of finding stuff in the acp because a lot of area sin there won't come up when searching for them by name in the search bar, for instance.
Midnight Modding Posted August 16, 2018 Author Posted August 16, 2018 And can my queue extension files have caused something like this due to that typo? Again, as far as I know, none of them have been used yet because they're all only triggered when sending over 15 notifications, whereas not even 15 members are in the system. Also, I had asked if these issues would be logged somewhere else when IN_DEV, because my system logs have nothing at all for weeks. I tried to find somewhere on disk where maybe you store them there when in dev, but I can't find anything.
bfarber Posted August 17, 2018 Posted August 17, 2018 It depends on the error, which unfortunately you have not provided. Uncaught exceptions would be logged in the system log, but PHP syntax errors wouldn't be.
Midnight Modding Posted August 17, 2018 Author Posted August 17, 2018 7 hours ago, bfarber said: It depends on the error, which unfortunately you have not provided. Uncaught exceptions would be logged in the system log, but PHP syntax errors wouldn't be. All I can do is give you what I have, which is my own memory. I can't paste something I have no access to. I mentioned that it's rare that it occurs and it's not in system logs. Also I did provide what the message itself said: "IPS\app\Something could not be loaded. be sure the class is named with an underscore and in the proper namespace". Something very similarly worded to that. So you'd know if that would be an uncaught exception or where IPS caught one and gave the message. And, again, this is the class that works everywhere, on many, many pages this class is used, so yes I named and located it properly. My system logs have issues from today then the most recent from before today are all the way back in july, even though I'm fairly certain I have had many uncaught exceptions since then while testing things and fixing bugs.
Midnight Modding Posted August 17, 2018 Author Posted August 17, 2018 A quick look through core's lang file doesn't show a message like that, so seems to me it must be an uncaught exception and the standard message for it. But it's not in system logs like today's uncaught exceptions are.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.