-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Promote warnings to exceptions in ext/shmop #5986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,57 +11,81 @@ edgarsandi - <[email protected]> | |
--FILE-- | ||
<?php | ||
|
||
echo PHP_EOL, '## shmop_open function tests ##'; | ||
// warning outputs: invalid flag when the flags length != 1 | ||
var_dump(shmop_open(1338, '', 0644, 1024)); | ||
echo PHP_EOL, '## shmop_open function tests ##', PHP_EOL; | ||
|
||
// warning outputs: invalid access mode | ||
var_dump(shmop_open(1338, 'b', 0644, 1024)); | ||
// Invalid flag when the flags length != 1 | ||
try { | ||
shmop_open(1338, '', 0644, 1024); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
|
||
// warning outputs: unable to attach or create shared memory segment | ||
try { | ||
shmop_open(1338, 'b', 0644, 1024); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
|
||
// Warning outputs: Unable to attach or create shared memory segment | ||
var_dump(shmop_open(null, 'a', 0644, 1024)); | ||
|
||
// warning outputs: Shared memory segment size must be greater than zero | ||
var_dump(shmop_open(1338, "c", 0666, 0)); | ||
// Shared memory segment size must be greater than zero | ||
try { | ||
shmop_open(null, 'a', 0644, 1024); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
|
||
//Shared memory segment size must be greater than zero | ||
try { | ||
shmop_open(1338, "c", 0666, 0); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
|
||
echo PHP_EOL, '## shmop_read function tests ##'; | ||
// warning outputs: start is out of range | ||
echo PHP_EOL, '## shmop_read function tests ##', PHP_EOL; | ||
// Start is out of range | ||
$shm_id = shmop_open(1338, 'n', 0600, 1024); | ||
var_dump(shmop_read($shm_id, -10, 0)); | ||
try { | ||
shmop_read($shm_id, -10, 0); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
shmop_delete($shm_id); | ||
|
||
// warning outputs: count is out of range | ||
// Count is out of range | ||
$shm_id = shmop_open(1339, 'n', 0600, 1024); | ||
var_dump(shmop_read($shm_id, 0, -10)); | ||
try { | ||
shmop_read($shm_id, 0, -10); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
shmop_delete($shm_id); | ||
|
||
echo PHP_EOL, '## shmop_write function tests ##'; | ||
// warning outputs: offset out of range | ||
echo PHP_EOL, '## shmop_write function tests ##', PHP_EOL; | ||
// Offset out of range | ||
$shm_id = shmop_open(1340, 'n', 0600, 1024); | ||
var_dump(shmop_write($shm_id, 'text to try write', -10)); | ||
try { | ||
shmop_write($shm_id, 'text to try write', -10); | ||
} catch (ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
shmop_delete($shm_id); | ||
?> | ||
kocsismate marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--EXPECTF-- | ||
## shmop_open function tests ## | ||
Warning: shmop_open(): is not a valid flag in %s on line %d | ||
bool(false) | ||
|
||
Warning: shmop_open(): Invalid access mode in %s on line %d | ||
bool(false) | ||
shmop_open(): Argument #2 ($flags) must be a valid access mode | ||
shmop_open(): Argument #2 ($flags) must be a valid access mode | ||
|
||
Warning: shmop_open(): Unable to attach or create shared memory segment '%s' in %s on line %d | ||
Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d | ||
bool(false) | ||
|
||
Warning: shmop_open(): Shared memory segment size must be greater than zero in %s on line %d | ||
bool(false) | ||
Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d | ||
shmop_open(): Argument #4 ($size) must be greater than 0 for the "c" and "n" access modes | ||
|
||
## shmop_read function tests ## | ||
Warning: shmop_read(): Start is out of range in %s on line %d | ||
bool(false) | ||
|
||
Warning: shmop_read(): Count is out of range in %s on line %d | ||
bool(false) | ||
shmop_read(): Argument #2 ($start) must be between 0 and the segment size | ||
shmop_read(): Argument #3 ($count) is out of range | ||
|
||
## shmop_write function tests ## | ||
Warning: shmop_write(): Offset out of range in %s on line %d | ||
bool(false) | ||
shmop_write(): Argument #3 ($offset) is out of range |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.