File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/Symfony/Component/Cache/Adapter Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ protected function doSave(array $values, $lifetime)
93
93
$ ok = true ;
94
94
$ data = array ($ lifetime ? time () + $ lifetime : PHP_INT_MAX , '' );
95
95
96
- foreach ($ values as $ id => $ value ) {
96
+ foreach ($ values as $ key => $ value ) {
97
97
if (null === $ value || is_object ($ value )) {
98
98
$ value = serialize ($ value );
99
99
} elseif (is_array ($ value )) {
@@ -109,13 +109,16 @@ protected function doSave(array $values, $lifetime)
109
109
$ value = serialize ($ value );
110
110
}
111
111
} elseif (!is_scalar ($ value )) {
112
- throw new InvalidArgumentException (sprintf ('Value of type "%s" is not serializable ' , $ key , gettype ($ value )));
112
+ throw new InvalidArgumentException (sprintf ('Cache key "%s" has non- serializable %s value. ' , $ key , gettype ($ value )));
113
113
}
114
114
115
115
$ data [1 ] = $ value ;
116
- $ file = $ this ->getFile ($ id , true );
116
+ $ file = $ this ->getFile ($ key , true );
117
117
$ ok = $ this ->write ($ file , '<?php return ' .var_export ($ data , true ).'; ' ) && $ ok ;
118
- @opcache_compile_file ($ file );
118
+
119
+ if ('cli ' !== PHP_SAPI || ini_get ('opcache.enable_cli ' )) {
120
+ @opcache_compile_file ($ file );
121
+ }
119
122
}
120
123
121
124
return $ ok ;
You can’t perform that action at this time.
0 commit comments