-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spyc is a common dependency. To avoid double class loading, inject a “class_exists” check around the Spyc class definition. It’s not bullet-proof but should help in some situations at least. fixes #832 issue #811 fixes #542
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?php | ||
| $spyc_class_file = "vendor/mustangostang/spyc/Spyc.php"; | ||
|
|
||
| $handle = fopen($spyc_class_file, "r+"); | ||
| $content = fread($handle, filesize($spyc_class_file)); | ||
|
|
||
| // if the check has not already been added only | ||
| if (!stripos($content, "if (!class_exists('Spyc'))")) { | ||
| $content = str_replace("class Spyc", "if (!class_exists('Spyc')) {\nclass Spyc", $content); | ||
| $content .= "\n}\n"; | ||
|
|
||
| rewind($handle); | ||
| fwrite($handle, $content); | ||
| } | ||
|
|
||
| fclose($handle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters