@@ -220,7 +220,6 @@ public function clearByNamespace($namespace)
220
220
}
221
221
222
222
$ prefix = $ namespace . $ this ->getOptions ()->getNamespaceSeparator ();
223
- $ prefixl = strlen ($ prefix );
224
223
$ result = true ;
225
224
226
225
$ this ->_open ();
@@ -230,7 +229,7 @@ public function clearByNamespace($namespace)
230
229
$ recheck = false ;
231
230
$ internalKey = dba_firstkey ($ this ->handle );
232
231
while ($ internalKey !== false && $ internalKey !== null ) {
233
- if (substr ($ internalKey , 0 , $ prefixl ) === $ prefix ) {
232
+ if (strpos ($ internalKey , $ prefix ) === 0 ) {
234
233
$ result = dba_delete ($ internalKey , $ this ->handle ) && $ result ;
235
234
}
236
235
@@ -259,7 +258,6 @@ public function clearByPrefix($prefix)
259
258
$ options = $ this ->getOptions ();
260
259
$ namespace = $ options ->getNamespace ();
261
260
$ prefix = ($ namespace === '' ) ? '' : $ namespace . $ options ->getNamespaceSeparator () . $ prefix ;
262
- $ prefixL = strlen ($ prefix );
263
261
$ result = true ;
264
262
265
263
$ this ->_open ();
@@ -269,7 +267,7 @@ public function clearByPrefix($prefix)
269
267
$ recheck = false ;
270
268
$ internalKey = dba_firstkey ($ this ->handle );
271
269
while ($ internalKey !== false && $ internalKey !== null ) {
272
- if (substr ($ internalKey , 0 , $ prefixL ) === $ prefix ) {
270
+ if (strpos ($ internalKey , $ prefix ) === 0 ) {
273
271
$ result = dba_delete ($ internalKey , $ this ->handle ) && $ result ;
274
272
$ recheck = true ;
275
273
}
0 commit comments