File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ public function whereKey($id)
269269 * Array format: ['key' => 'value', 'key2' => 'value2']
270270 *
271271 * Custom option keys must follow OData naming conventions:
272- * - Must not start with '$' (reserved for standard OData parameters)
272+ * - Must not start with '$' or '@' (reserved for standard OData parameters)
273273 * - Must be valid identifiers (alphanumeric and underscores)
274274 * - Cannot be empty
275275 *
@@ -370,9 +370,9 @@ protected function validateCustomOptionKey($key)
370370 throw new \InvalidArgumentException ('Custom option key must be a non-empty string ' );
371371 }
372372
373- // Check if key starts with '$' (reserved for OData system parameters)
374- if (strpos ($ key , '$ ' ) === 0 ) {
375- throw new \InvalidArgumentException ("Custom option key ' $ key' cannot start with ' \$' (reserved for OData system parameters) " );
373+ // Check if key starts with '$' or '@' (reserved for OData system parameters)
374+ if (strpos ($ key , '$ ' ) === 0 || strpos ( $ key , ' @ ' ) === 0 ) {
375+ throw new \InvalidArgumentException ("Custom option key ' $ key' cannot start with ' \$' or '@' (reserved for OData system parameters) " );
376376 }
377377
378378 // Check for valid identifier pattern (alphanumeric, underscores, hyphens)
Original file line number Diff line number Diff line change @@ -170,12 +170,21 @@ public function testAddOptionIgnoresNullAndEmpty()
170170 public function testAddOptionValidatesKeyStartingWithDollar ()
171171 {
172172 $ this ->expectException (\InvalidArgumentException::class);
173- $ this ->expectExceptionMessage ('Custom option key \'$invalid \' cannot start with \'$ \'' );
173+ $ this ->expectExceptionMessage ('Custom option key \'$invalid \' cannot start with \'$ \' or \' @ \' ' );
174174
175175 $ builder = $ this ->getBuilder ();
176176 $ builder ->addOption (['$invalid ' => 'value ' ]);
177177 }
178178
179+ public function testAddOptionValidatesKeyStartingWithAt ()
180+ {
181+ $ this ->expectException (\InvalidArgumentException::class);
182+ $ this ->expectExceptionMessage ('Custom option key \'@invalid \' cannot start with \'$ \' or \'@ \'' );
183+
184+ $ builder = $ this ->getBuilder ();
185+ $ builder ->addOption (['@invalid ' => 'value ' ]);
186+ }
187+
179188 public function testAddOptionValidatesEmptyKey ()
180189 {
181190 $ this ->expectException (\InvalidArgumentException::class);
You can’t perform that action at this time.
0 commit comments