Skip to content

Bug #70861: Fix binding of empty string resource as a parameter. #1619

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
wants to merge 1 commit into from

Conversation

LionsAd
Copy link

@LionsAd LionsAd commented Nov 5, 2015

See: https://bugs.php.net/bug.php?id=70861

The original fix for https://bugs.php.net/bug.php?id=70861 unfortunately did fix the crash, but not the issue.

The problem is given a PG SQL PDO stmt $stmt when doing:

         $value = '';

          $blob = fopen('php://memory', 'a');
          fwrite($blob, $value);
          rewind($blob);

          $stmt->bindParam(':db_insert_placeholder_0' , $blob, \PDO::PARAM_LOB);

That then php_stream_copy_to_mem() returns NULL, but if we don't bind the placeholder than the query fails.

The attached patch uses an empty ZSTR to remove the problem, which probably makes sense that an empty resource is mapped to an empty string instead of NULL.

There might be a better fix available, but this fixes the test for me.

@php-pulls
Copy link

Comment on behalf of ab at php.net:

Merged, thanks!

@php-pulls php-pulls closed this Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants