Skip to content

Commit

Permalink
Correctly encode numeric values for enum fields
Browse files Browse the repository at this point in the history
This partially fixes smalot#2, but a complete fix will
require handling the non-numeric values for enum fields. A table
of those could be pulled from RFC 8011.
  • Loading branch information
jimwins committed Dec 30, 2018
1 parent 3036fde commit d3436dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Builder/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ public function buildProperty($name, $values, $emptyIfMissing = false)
break;

case 'enum':
// @todo: alter specials types
if (is_numeric($value)) {
$value = pack('N', $value);
} else {
// @todo: handle values for enum types from RFC 8011
throw new CupsException('Non-numeric enum value not supported for : "'.$name.'".');
}
break;

case 'range_of_integers':
Expand Down

0 comments on commit d3436dd

Please sign in to comment.