I've been told by someone here to pare down my code and submit a bug report. However, paring down my code corrected the problem, so I'm still not sure what a PHP Access Violation error is. Following is the post I made to php-general with my "solution." Am I on the right track with my guess as to what may have been occurring with the Access Violation errors, and should I still submit a bug report?

-----

So, I found a solution to my problem. I still do not know what was causing the PHP Access Violation errors, but I have an idea, which I will relate in this message.

As many suggested, I have pared down my mail sending class by rewriting it down to about 250 lines of code. Previously, the PEAR::Mail::smtp class had much fewer lines of code, but if you count all of the other files it had to include, then it was a whopping amount of code. The difference here is that I am only using one class now to send mail, whereas the PEAR::Mail::smtp class was using about 5 different classes. Let me walk you through them.

Mail::smtp included and extended the Mail class. The Mail class included and extended the PEAR class. The send() method of Mail::smtp included the Net::SMTP class and created an object of that class. The Net::SMTP class included the PEAR and Net::Socket classes (and optionally checked for and included the Auth::SASL class). The Net_SMTP() contstructor created a Net::Socket object. The Net::Socket class included and extended the PEAR class.

So, in all, that's about 5 classes that Mail::stmp needed. Once I got it down to one class, the Access Violations disappeared. So, here's what I think was happening with the classes based on some of the information I have been told.

I've been told that the Access Violation errors are probably caused when PHP tries to access a space of memory that it doesn't have permission to access. From this, I'm gathering that the sheer number of classes needed and objects and variables created confused PHP so that it wasn't sure what pointers pointed to the correct space in memory. (Again, I'm out on a limb with this guess.) Because the pointer lost its space in memory (I'm guessing that's what happened), PHP tried to access a space that it either no longer had permission to access or it never had permission to access.

Make sense? I'm sharing this here because several people expressed an interest in knowing how it got resolved.

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to