google-code-export / apns-php

Automatically exported from code.google.com/p/apns-php
0 stars 0 forks source link

ApnsPHP_Autoload should not throw Exceptions #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The main issue with having the exceptions is a function like class_exists will 
cause exceptions because of ApnsPHP_Autoload when it shouldn't.

And yes, I do know class_exists has a second parameter BUT in cases where you 
want to autoload a class if it exists, but do something else if it does it will 
fail.

An example of this is redbean, in combination with apns-php will cause errors 
because it uses class_exists, and if it fails then it continues without using 
the class.

Original issue reported on code.google.com by dgs...@gmail.com on 15 Nov 2011 at 7:03

GoogleCodeExporter commented 9 years ago
Yeah, I can confirm that using apns-php in combination with certain Drupal 
modules will also fail on the thrown exception in ApnsPHP_Autoload, as these 
other modules also implement it. 

Original comment by administ...@uncinc.nl on 19 Apr 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Seconded on the Drupal modules. As the ApnsPHP_Autoload checks using it's own 
relative path when checking for class files all sorts of fun can happen when 
some other autloading code is looking elsewhere for theirs.

Currently need to work around it with my own Autoload.php which simply doesn't 
throw exceptions.

I figure best practice is to not throw errors in that context.

Since the exceptions are not necessarily (not likely even) thrown in the code 
where you call Autoload.php you would have to catch the exceptions in code that 
you might not want to hack (such as other libraries and modules). In my case it 
would be ridiculous to hack the well established Views module code base to 
catch these exceptions.

For this project by the way: http://drupal.org/sandbox/lawik/1507982 (APN for 
Drupal)

Original comment by jellb...@gmail.com on 15 May 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Dear,

The project source code has moved to github; if your issue is still valid, 
please open it on github page https://github.com/duccio/ApnsPHP/issues

Thanks.

Original comment by aldo.arm...@gmail.com on 26 Oct 2012 at 11:45