Skip to content
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

Mistake in help: Data protocol in PHP expects urlencoded data. #19

Closed
v-mabarw opened this issue Jul 29, 2014 · 2 comments
Closed

Mistake in help: Data protocol in PHP expects urlencoded data. #19

v-mabarw opened this issue Jul 29, 2014 · 2 comments

Comments

@v-mabarw
Copy link
Contributor

PHP has a feature to open the stream from string passed through RFC 2397 data:
protocol.
The SQLSRV help describes this feature to send the data as a stream to the MS-
SQL server.

However, data passed in „data:text/plain,…“ string should be either urlencoded
or base64 encoded. Otherwise serious damage of the data occurs, because when
data are not passed as base64, PHP urldecodes them (+ becomes space, %20
entities get decoded, etc.)

PROBLEM:
In the SQLSRV help, all source code lines opening stream from string should be
modified according the correct syntax.
Incorrect syntax: fopen( "data://text/plain,[ Insert lengthy comment here.]",
"r");
Correct syntax, option #1: fopen("data:text/plain,".urlencode('[ Insert
lengthy comment here.]')."", "r");
Correct syntax, option #2: fopen("data:text/plain;base64,".base64_encode('[
Insert lengthy comment here.]')."", "r");

TEST CASE:
Just run this code in PHP:

Links:
PHP Data stream: http://php.net/manual/en/wrappers.data.php

RFC 2397: http://www.faqs.org/rfcs/rfc2397.html

Work Item Details

Original CodePlex Issue: Issue 19139
Status: Proposed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Nov 18, 2010 at 11:44 AM
Reported by: michalkocarek
Updated on: Nov 18, 2010 at 11:45 AM
Updated by: michalkocarek

@yitam
Copy link
Contributor

yitam commented Jan 12, 2017

No links to the SQLSRV documentation were specified in the original description. The potential ones are listed below. Please confirm.

http://php.net/manual/en/function.sqlsrv-send-stream-data.php
https://msdn.microsoft.com/en-us/library/cc296180(v=sql.105).aspx
https://msdn.microsoft.com/en-us/library/cc296191(v=sql.105).aspx

@yitam yitam self-assigned this Feb 10, 2017
@Hadis-Knj Hadis-Knj self-assigned this Feb 14, 2017
@yitam
Copy link
Contributor

yitam commented Mar 4, 2019

Closing issue. The aforementioned doc pages have been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants