File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,15 @@ class Config
5757 public string $ phpwebSourcesFilename = '' ;
5858 public string $ phpwebHistoryFilename = '' ;
5959
60+ private const NON_SERIALIZABLE_PROPERTIES = [
61+ "copyright " ,
62+ "indexCache " ,
63+ "phpErrorOutput " ,
64+ "userErrorOutput " ,
65+ "phdInfoOutput " ,
66+ "phdWarningOutput " ,
67+ ];
68+
6069 public function __construct () {
6170 $ this ->copyright = 'Copyright(c) 2007- ' . \date ('Y ' ) . ' The PHP Documentation Group ' ;
6271
@@ -76,19 +85,29 @@ public function init(array $configOptions): void {
7685 throw new \Exception ("Invalid option supplied: $ option " );
7786 }
7887
88+ if (\in_array ($ option , self ::NON_SERIALIZABLE_PROPERTIES , true )) {
89+ continue ;
90+ }
91+
7992 $ this ->$ option = $ value ;
8093 }
8194
8295 \error_reporting ($ GLOBALS ['olderrrep ' ] | $ this ->verbose );
8396 }
8497
8598 /**
86- * Returns all configuration options and their values
99+ * Returns all serializable configuration options and their values
87100 *
88101 * @return array<string, mixed>
89102 */
90- public function getAllFiltered (): array {
91- return \get_object_vars ($ this );
103+ public function getAllSerializableProperties (): array {
104+ $ object_vars = \get_object_vars ($ this );
105+
106+ foreach (self ::NON_SERIALIZABLE_PROPERTIES as $ property ) {
107+ unset($ object_vars [$ property ]);
108+ }
109+
110+ return $ object_vars ;
92111 }
93112
94113 /**
Original file line number Diff line number Diff line change 7474
7575if ($ config ->saveConfig ) {
7676 $ outputHandler ->v ("Writing the config file " , VERBOSE_MESSAGES );
77- file_put_contents ("phd.config.php " , "<?php \nreturn " . var_export ($ config ->getAllFiltered (), 1 ) . "; " );
77+ file_put_contents ("phd.config.php " , "<?php \nreturn " . var_export ($ config ->getAllSerializableProperties (), 1 ) . "; " );
7878}
7979
8080if ($ config ->quit ) {
You can’t perform that action at this time.
0 commit comments